Skip to content

Fastapi-mail

The fastapi-mail is a simple lightweight mail system, for sending emails and attachments(individual && bulk)

MIT licensed GitHub stars GitHub forks GitHub issues Downloads

Using Jinja2 HTML Templates

In order to use Jinja template langauge, you must specify the email folder within your application's working directory.

When sending HTML emails, the CSS expected by mail servers -outlook, google, etc- must be inline CSS. Fastapi mail passes "body" to the rendered template. In creating the template for emails the dynamic objects should be used with the assumption that the variable is named "body" and that it is a python dict.

check out jinja2 for more details jinja2

Guide for Email Utils

The utility allows you to check temporary email addresses, you can block any email or domain. You can connect Redis to save and check email addresses. If you do not provide a Redis configuration, then the utility will save it in the list or set by default.

Writing unittests using Fastapi-Mail

Fastapi-mail allows you to write unittest for your application without sending emails to non existent email address by mocking the email to be sent. To mock sending out mails, set the suppress configuration to true. Suppress send defaults to False to prevent mocking within applications.

Support for Reply-To header is added

Use this just like bcc but to specify addresses that should receive a reply to your message. E-mail systems MAY respect this as per RFC 2822.