Skip to main content
Django’s email framework supports an SMTP backend natively. Route all application emails through mySMTP by updating your settings and running a quick test.

Prerequisites

SMTP settings

Shared IP plans are only available to customers in Denmark.

Configure settings.py

1

Add SMTP settings

In your project’s settings.py, add or update the email backend variables:
Use EMAIL_USE_TLS = True with port 587. Do not enable EMAIL_USE_SSL at the same time; that setting is for implicit TLS on port 465.
2

Load credentials from environment

For security, load sensitive values from environment variables instead of hardcoding them:
3

Send a test email

You can test from the Django shell:
Then run:
Alternatively, use the built-in management command if it is available in your project:
Never commit passwords to version control. Use environment variables, a .env file with python-dotenv, or your deployment platform’s secret management.

Troubleshooting

Confirm you are using your real mySMTP hostname (not relayxx.mysmtp.com). Check that your hosting environment allows outbound connections on port 587. If blocked, try port 2525.
Re-enter your mySMTP username and password. Verify there are no extra spaces or encoding issues. Test the exact credentials with a standalone script or test.smtp.ai first.
Verify SPF, DKIM, and DMARC are configured for your sending domain. See DNS settings quick explainer and SPF, DKIM, DMARC, and BIMI explained.
Run the Sender Readiness Checklist and Email Header Analyzer in the mySMTP Deliverability Toolbox.
Check Django server logs for SMTP exceptions. Also confirm DEFAULT_FROM_EMAIL uses a domain authenticated with mySMTP.
Django’s email framework supports an SMTP backend natively. Route all application emails through mySMTP by updating your settings and running a quick test.

Prerequisites

SMTP settings

Shared IP plans are only available to customers in Denmark.

Configure settings.py

1

Add SMTP settings

In your project’s settings.py, add or update the email backend variables:
Use EMAIL_USE_TLS = True with port 587. Do not enable EMAIL_USE_SSL at the same time; that setting is for implicit TLS on port 465.
2

Load credentials from environment

For security, load sensitive values from environment variables instead of hardcoding them:
3

Send a test email

You can test from the Django shell:
Then run:
Alternatively, use the built-in management command if it is available in your project:
Never commit passwords to version control. Use environment variables, a .env file with python-dotenv, or your deployment platform’s secret management.

Troubleshooting

Confirm you are using your real mySMTP hostname (not relayxx.mysmtp.com). Check that your hosting environment allows outbound connections on port 587. If blocked, try port 2525.
Re-enter your mySMTP username and password. Verify there are no extra spaces or encoding issues. Test the exact credentials with a standalone script or test.smtp.ai first.
Verify SPF, DKIM, and DMARC are configured for your sending domain. See DNS settings quick explainer and SPF, DKIM, DMARC, and BIMI explained.
Run the Sender Readiness Checklist and Email Header Analyzer in the mySMTP Deliverability Toolbox.
Check Django server logs for SMTP exceptions. Also confirm DEFAULT_FROM_EMAIL uses a domain authenticated with mySMTP.