Requirements
SMTP credentials for transactional email, with provider notes for SendGrid, SES, Mailgun and Postmark.
Rapid response requires SMTP credentials to send email. This document describes how to configure email functionality.
Overview
The application uses Django's built-in email backend to send transactional emails. Email credentials and configuration are managed through environment variables.
At the time of writing, the emails sent out are primarily transactional.
Environment Configuration
Once you have followed the steps below, you will add the following credentials
to your .env file:
# Email configurations
[email protected]
EMAIL_HOST=smtp.sendgrid.net
EMAIL_HOST_USER=apikey
EMAIL_HOST_PASSWORD=SG.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
EMAIL_PORT=587
EMAIL_USE_TLS=True
Configuration Parameters
- DEFAULT_FROM_EMAIL: The default email address used as the sender for outgoing emails
- EMAIL_HOST: SMTP server hostname (example shows SendGrid)
- EMAIL_HOST_USER: Username for SMTP authentication (SendGrid uses
apikeyas the username) - EMAIL_HOST_PASSWORD: Your SMTP password or API key
- EMAIL_PORT: SMTP port (typically 587 for TLS or 465 for SSL)
- EMAIL_USE_TLS: Enable TLS encryption for secure email transmission
Email Service Providers
While the example above uses SendGrid, you can use any SMTP-compatible email service. Popular options include:
- SendGrid
- Amazon SES
- Mailgun
- Postmark
- Gmail (for development only)
Consult your email provider's documentation for the correct SMTP settings.
SaaS Provider Options
SendGrid
SendGrid is a cloud-based email delivery platform that provides reliable transactional email delivery.
Setup Steps:
- Create a SendGrid account at sendgrid.com
- Generate an API key from the SendGrid dashboard
- Use the following configuration:
EMAIL_HOST:smtp.sendgrid.netEMAIL_HOST_USER:apikeyEMAIL_HOST_PASSWORD: Your generated API keyEMAIL_PORT:587EMAIL_USE_TLS:True
Documentation: SendGrid SMTP Documentation
Amazon SES
Amazon Simple Email Service (SES) is a cost-effective email service built on AWS infrastructure.
Setup Steps:
- Configure Amazon SES in your AWS account
- Verify your sending domain or email address
- Generate SMTP credentials from the SES console
- Use the following configuration:
EMAIL_HOST: Your region-specific SES SMTP endpoint (e.g.,email-smtp.us-east-1.amazonaws.com)EMAIL_HOST_USER: Your SMTP usernameEMAIL_HOST_PASSWORD: Your SMTP passwordEMAIL_PORT:587EMAIL_USE_TLS:True
Documentation: Amazon SES SMTP Documentation
Mailgun
Mailgun provides email API and SMTP relay services with powerful analytics and tracking.
Setup Steps:
- Sign up for Mailgun at mailgun.com
- Add and verify your domain
- Retrieve your SMTP credentials from the domain settings
- Use the following configuration:
EMAIL_HOST:smtp.mailgun.org(or your region-specific endpoint)EMAIL_HOST_USER: Your SMTP username (typically[email protected])EMAIL_HOST_PASSWORD: Your SMTP passwordEMAIL_PORT:587EMAIL_USE_TLS:True
Documentation: Mailgun SMTP Documentation
Postmark
Postmark specializes in transactional email delivery with a focus on speed and deliverability.
Setup Steps:
- Create a Postmark account at postmarkapp.com
- Create a server and retrieve your SMTP credentials
- Use the following configuration:
EMAIL_HOST:smtp.postmarkapp.comEMAIL_HOST_USER: Your server tokenEMAIL_HOST_PASSWORD: Your server token (same as username)EMAIL_PORT:587EMAIL_USE_TLS:True
Documentation: Postmark SMTP Documentation
Additional Resources
For more information about Django's email functionality, see the official Django documentation: