apicrud.messaging.send

send.py

Send a message TODO redesign this as a class, it evolved from the oldest crappy script

created 18-apr-2019 by richb@instantlinux.net

Functions

smtp_session(settings, db_session)

Open an SMTP connection to the account’s defined smtp_smarthost

to_contact(db_session[, smtp, frm, to, …])

param db_session

open session to database

Exceptions

SendException

exception apicrud.messaging.send.SendException
apicrud.messaging.send.smtp_session(settings, db_session)

Open an SMTP connection to the account’s defined smtp_smarthost

Parameters

settings (obj) – settings object

apicrud.messaging.send.to_contact(db_session, smtp=None, frm=None, to=None, template=None, account_id=None, settings=None, attachments=[], **kwargs)
Parameters
  • db_session (obj) – open session to database

  • smtp (obj) – open session to SMTP smarthost

  • frm (uid) – person

  • to (Contact) – recipient

  • template (str) – jinja2 template name

  • account_id (str) – ID of logged-in account

  • settings (obj) – the AccountSettings for the account

  • attachments (list) – additional MIMEBase / MimeText objects

  • kwargs – kv pairs

Raises

SendException