Mail

Ferris provides a couple of lightweight wrapper functions around the App Engine Mail API for sending emails.

ferris.core.mail.send(recipient, subject, body, sender=None, reply_to=None, **kwargs)[source]

Sends an html email to recipient with the given subject and body.

If sender is none, it’s automatically set to app_config['email']['sender'].

Any additionally arguments are passed to mail.send_mail, such as headers.

ferris.core.mail.send_template(recipient, subject, template_name, context=None, theme=None, **kwargs)[source]

Renders a template and sends an email in the same way as send(). templates should be stored in /templates/email/<template>.html.

For example:

mail.send_template(
    recipient='jondoe@example.com',
    subject='A Test Email',
    template_name='test',
    context={
        'name': 'George'
    }
)

Would render the template /templates/email/test.html and email the rendered html.