Markdown-templated email.

An email template looks like this:

subject: Hello, {{user.first_name}}
Welcome to the site.

When using send_markdown_mail(), its output is placed in a layout to produce a full html document::

<!DOCTYPE html>

The default layout is specified in settings.EMAIL_LAYOUT, but can be overridden on a per-email basis.

fusionbox.mail.create_markdown_mail(template, context, to=None, subject=None, from_address='settings.SERVER_EMAIL', layout='settings.EMAIL_LAYOUT')[source]

Creates a message from a markdown template and returns it as an EmailMultiAlternatives object.

fusionbox.mail.send_markdown_mail(*args, **kwargs)[source]

Wrapper around create_markdown_mail() that creates and sends the message in one step.

fusionbox.mail.render_template(template, context, layout)[source]

With a markdown template, a context to render it in, and a layout to generate html from it, a 3-tuple of (metadata, markdown content, html content) is returned.


Given a string with YAML style front matter, returns the parsed header and the rest of the string in a 2-tuple.

>>> extract_frontmatter('---\nfoo: bar\n---\nbody content\n')
({'foo': 'bar'}, 'body content\n')