Prerequisites
- A Django project
- Your mySMTP credentials (see Setting up SMTP credentials)
- A verified sending domain
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: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:
Troubleshooting
Connection refused or timeout
Connection refused or timeout
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.Authentication failed
Authentication failed
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.
Emails go to spam
Emails go to spam
Verify SPF, DKIM, and DMARC are configured for your sending domain. See DNS settings quick explainer and SPF, DKIM, DMARC, and BIMI explained.
Test email does not arrive
Test email does not arrive
Check Django server logs for SMTP exceptions. Also confirm
DEFAULT_FROM_EMAIL uses a domain authenticated with mySMTP.Related articles
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
- A Django project
- Your mySMTP credentials (see Setting up SMTP credentials)
- A verified sending domain
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: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:
Troubleshooting
Connection refused or timeout
Connection refused or timeout
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.Authentication failed
Authentication failed
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.
Emails go to spam
Emails go to spam
Verify SPF, DKIM, and DMARC are configured for your sending domain. See DNS settings quick explainer and SPF, DKIM, DMARC, and BIMI explained.
Test email does not arrive
Test email does not arrive
Check Django server logs for SMTP exceptions. Also confirm
DEFAULT_FROM_EMAIL uses a domain authenticated with mySMTP..png?fit=max&auto=format&n=-Uw4rR8wfyv_xkzc&q=85&s=898bb0b43b6c9dce61441f46ac9ac860)