Requirements

Email

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 apikey as 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:

  1. Create a SendGrid account at sendgrid.com
  2. Generate an API key from the SendGrid dashboard
  3. Use the following configuration:
    • EMAIL_HOST: smtp.sendgrid.net
    • EMAIL_HOST_USER: apikey
    • EMAIL_HOST_PASSWORD: Your generated API key
    • EMAIL_PORT: 587
    • EMAIL_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:

  1. Configure Amazon SES in your AWS account
  2. Verify your sending domain or email address
  3. Generate SMTP credentials from the SES console
  4. 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 username
    • EMAIL_HOST_PASSWORD: Your SMTP password
    • EMAIL_PORT: 587
    • EMAIL_USE_TLS: True

Documentation: Amazon SES SMTP Documentation

Mailgun

Mailgun provides email API and SMTP relay services with powerful analytics and tracking.

Setup Steps:

  1. Sign up for Mailgun at mailgun.com
  2. Add and verify your domain
  3. Retrieve your SMTP credentials from the domain settings
  4. 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 password
    • EMAIL_PORT: 587
    • EMAIL_USE_TLS: True

Documentation: Mailgun SMTP Documentation

Postmark

Postmark specializes in transactional email delivery with a focus on speed and deliverability.

Setup Steps:

  1. Create a Postmark account at postmarkapp.com
  2. Create a server and retrieve your SMTP credentials
  3. Use the following configuration:
    • EMAIL_HOST: smtp.postmarkapp.com
    • EMAIL_HOST_USER: Your server token
    • EMAIL_HOST_PASSWORD: Your server token (same as username)
    • EMAIL_PORT: 587
    • EMAIL_USE_TLS: True

Documentation: Postmark SMTP Documentation

Additional Resources

For more information about Django's email functionality, see the official Django documentation:

Previous
Twilio