Django SMTP: seven lines in settings.py
send_mail, password resets and notifications: Django sends through SMTP Senpai with the standard SMTP backend.
- Free plan, no card and no expiry
- 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. After the first send, the free email spam test gives it a score from 0 to 10.
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 or 587.
Test it
python manage.py sendtestemail [email protected]
Prefer the API to SMTP? The mailsenpai package includes a Django email backend: in settings.py set EMAIL_BACKEND = "mailsenpai.django.EmailBackend" and MAILSENPAI_API_KEY.
pip install mailsenpaiUse the Django API backend over HTTPS
Install pip install mailsenpai in your Django environment (the package itself requires Python 3.9+ and does not install Django). Obtain an API key from the customer area and verify your sender domain. These settings use the EMAIL_BACKEND configuration supported by the backend; follow your installed Django version when configuring mailers.
# settings.py
import os
EMAIL_BACKEND = "mailsenpai.django.EmailBackend"
MAILSENPAI_API_KEY = os.environ["MAILSENPAI_API_KEY"]
DEFAULT_FROM_EMAIL = os.environ["VERIFIED_FROM"]
MAILSENPAI_TIMEOUT = 30Set the environment variables, then run python manage.py sendtestemail with a recipient mailbox you control. Keep fail_silently=False while diagnosing failures so exceptions are visible. Test the actual password-reset or notification workflow after the test email, and inspect the received headers as well as delivery events.
Controlled local check, before using a real account
On 19 October 2026 we installed the published mailsenpai 1.0.0 wheel with Python 3.14.5 and Django 5.2.18 in an isolated environment. A real Django email backend sent text, HTML, Reply-To and an attachment to a loopback HTTP double; the check also covered 401, 403 and 429 exceptions and fail_silently. Reproduce the local check or read the recorded result. It uses a fake key and example.invalid addresses, with no external API calls or real email. This validates the controlled integration path; production acceptance, delivery, inbox placement and other framework versions require separate tests.
Read the error before retrying
An invalid-key error requires checking the saved key and account state. A sender-domain rejection requires verifying that domain. A quota or rate-limit response requires waiting for the relevant limit or reviewing the plan; a network timeout requires checking outbound connectivity. Avoid blind retries: they do not correct credentials or DNS. Keep credentials and customer information out of public logs.
Use the official package page, source and setup reference and API error and delivery-event documentation. Service logs are retained for 7 days on the free plan and 90 days on paid plans. A local application log may have different retention.
Frequently asked questions
EMAIL_USE_TLS or EMAIL_USE_SSL?
EMAIL_USE_TLS = True: ports 2525 and 587 use 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
WordPress
SMTP for WordPress
OpenLaravel
SMTP for Laravel
OpenNode.js
SMTP for Node.js
OpenStrapi
SMTP for Strapi
Openn8n
SMTP for n8n
OpenPrestaShop
SMTP for PrestaShop
OpenJoomla
SMTP for Joomla
OpenDrupal
SMTP for Drupal
OpenOpenCart
SMTP for OpenCart
OpenMagento 2
SMTP for Magento 2
OpenCraft CMS
SMTP for Craft CMS
OpenStatamic
SMTP for Statamic
OpenTYPO3
SMTP for TYPO3
OpenOctober CMS
SMTP for October CMS
OpenTry SMTP Senpai with your own software
Start free: connect your software, send your real emails and check the log line by line. No card and no expiry.