Django
Send transactional emails from your Django project using Loops’ SMTP service.
As Loops’ SMTP service requires sending an API-like email body rather than a full email, it’s not recommended to use Loops as the default SMTP service for your app in your settings file.
Instead, use a custom connection
for each email request that you want to send through Loops.
Sending email from Django with Loops’ SMTP service is easy but there’s one gotcha: the email body needs to be an API-like payload.
This may seem strange at first but it allows you to use Loops’ WYSIWYG editor to craft your emails and keep email templating outside of your code repo.
We are using a custom connection
for sending this email as typically only some emails in a project will be sent through Loops.
Add these settings to your project (e.g. in an .env
file).
Field | Value |
---|---|
Host | smtp.loops.so |
Port number | 587 |
Username | loops |
Password | An API key copied from your API settings in Loops |
Every email sent from Django over Loops SMTP requires a transactional email to be set up in your Loops account. Note the transactionalId
value in the email payload.