Django SMTP: seven lines in settings.py
send_mail, password resets and notifications: Django sends through SMTP Senpai with the standard SMTP backend.
- 14-day free trial
- Servers and data in the EU
- A log of every delivery
import os EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend" EMAIL_HOST = "relay.mailsenpai.com" EMAIL_PORT = 2525 EMAIL_USE_TLS = True # STARTTLS EMAIL_HOST_USER = os.environ["SMTP_USER"] EMAIL_HOST_PASSWORD = os.environ["SMTP_PASS"] DEFAULT_FROM_EMAIL = "[email protected]"
Four details, and your emails go out
They are the same for every program: you also find them, already filled in, in your customer area.
The sender must be on a domain verified in your area: otherwise the server refuses to send. For SPF, DKIM and DMARC records, use the free email DNS checker.
Three steps
Copy the details
Username and password from the customer area, in environment variables.
Update settings.py
Paste the lines: EMAIL_USE_TLS turns on STARTTLS on port 2525.
Test it
python manage.py sendtestemail [email protected]
Frequently asked questions
EMAIL_USE_TLS or EMAIL_USE_SSL?
EMAIL_USE_TLS = True: port 2525 uses STARTTLS. Do not turn on EMAIL_USE_SSL.
Does it work with Celery?
Yes: tasks that call send_mail use the same SMTP backend.
What about Flask or FastAPI?
The same four details work with smtplib and any SMTP library in Python.
More integration guides
Try SMTP Senpai with your own software
A 14-day trial: connect your software, send your real emails and check the log line by line. Then decide.