apicrud.messaging.format

format.py

MIME and SMS formatting

created 15-aug-2020 by docker@instantlinux.net

Functions

email(content, frm, sender_email, to, …)

Format an email message with mime attachment, in the user’s profile-determined locale

sms(content, frm, to, **kwargs)

Format an SMS message content (str): i18n dict frm (Contact): contact of sender to (Contact): contact of recipient **kwargs: other key=value pairs for jinja2 substitution

apicrud.messaging.format.email(content, frm, sender_email, to, settings, db_session, models, i18n, **kwargs)

Format an email message with mime attachment, in the user’s profile-determined locale

Parameters
  • content (str) – i18n dict

  • frm (Contact) – contact of sender

  • sender_email (str) – destination address

  • to (Contact) – contact of recipient

  • settings (obj) – account settings

  • db_session – database session

  • models – db models (for user Profile)

  • i18n – localization context

  • **kwargs – other key=value pairs for jinja2 substitution

Returns

mime object (the as_string() method will convert to message)

apicrud.messaging.format.sms(content, frm, to, **kwargs)

Format an SMS message content (str): i18n dict frm (Contact): contact of sender to (Contact): contact of recipient **kwargs: other key=value pairs for jinja2 substitution