apicrud.messaging.format¶
format.py
MIME and SMS formatting
created 15-aug-2020 by docker@instantlinux.net
Functions
|
Format an email message with mime attachment, in the user’s profile-determined locale |
|
Format an SMS message |
Exceptions
-
exception
apicrud.messaging.format.
FormatException
¶
-
apicrud.messaging.format.
email
(template, frm, sender_email, to, settings, db_session, attachments=[], **kwargs)¶ Format an email message with mime attachment, in the user’s profile-determined locale
- Parameters
template (str) – jinja2 template name
frm (Contact) – contact of sender
sender_email (str) – destination address
to (Contact) – contact of recipient
settings (obj) – account settings
db_session (obj) – database session
attachments (list) – additional MIMEBase / MimeText objects
**kwargs – other key=value pairs for jinja2 substitution
- Returns
mime object (use .as_string() to convert to message)
- Return type
obj
-
apicrud.messaging.format.
sms
(template, frm, to, settings, db_session, **kwargs)¶ Format an SMS message
- Parameters
template (str) – jinja2 template name
frm (Contact) – contact of sender
to (Contact) – contact of recipient
**kwargs – other key=value pairs for jinja2 substitution
- Returns
Formatted string content
- Return type
str