eusend
SMTP

Django SMTP

Configure Django's email backend to send through eusend over SMTP — password resets, notifications, and any send_mail call, DKIM-signed and tracked.

Django's SMTP email backend works with eusend out of the box — no extra packages. Set five settings and every send_mail, EmailMessage, password-reset, and django.contrib.auth email routes through eusend, DKIM-signed and tracked.

settings.py

settings.py
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.eusend.dev'
EMAIL_PORT = 465
EMAIL_USE_SSL = True          # implicit TLS — not EMAIL_USE_TLS
EMAIL_HOST_USER = 'eusend'    # always the literal string "eusend"
EMAIL_HOST_PASSWORD = os.environ['EUSEND_API_KEY']  # eu_live_…

# Must be an address on a domain verified in eusend
DEFAULT_FROM_EMAIL = 'Acme <no-reply@yourdomain.com>'
⚠

Use EMAIL_USE_SSL = True (implicit TLS on port 465), not EMAIL_USE_TLS. Setting both raises ValueError: EMAIL_USE_TLS/EMAIL_USE_SSL are mutually exclusive.

Send an email

from django.core.mail import send_mail

send_mail(
    subject='Your order has shipped',
    message='Order #1234 is on its way.',
    from_email=None,                      # falls back to DEFAULT_FROM_EMAIL
    recipient_list=['alice@example.com'],
    html_message='<p>Order #1234 is on its way.</p>',
)

Test it from the shell without touching a view:

python manage.py shell -c "from django.core.mail import send_mail; \
send_mail('Test', 'Body', None, ['you@example.com'])"

Connection reference

SettingValue
EMAIL_HOSTsmtp.eusend.dev
EMAIL_PORT465
EMAIL_USE_SSLTrue
EMAIL_HOST_USEReusend
EMAIL_HOST_PASSWORDyour eusend API key (eu_live_…)
DEFAULT_FROM_EMAILan address on a verified domain

Use an eu_test_ key while developing — sends are accepted and tracked but never delivered. See the SMTP overview for limits and status codes.

Troubleshooting

SymptomCause and fix
EMAIL_USE_TLS/EMAIL_USE_SSL are mutually exclusive, so only set one of those settings to True.Both settings are True. eusend uses implicit TLS, so keep EMAIL_USE_SSL = True and remove EMAIL_USE_TLS or set it to False.
The send hangs, then SMTPServerDisconnected: Connection unexpectedly closed or a timeoutEMAIL_USE_TLS = True makes Django start a plaintext session and ask for STARTTLS, which port 465 does not speak. Use EMAIL_USE_SSL = True with EMAIL_PORT = 465.
SMTPAuthenticationError: (535, …)Read the response text. Invalid credentials means the username is not the literal eusend or the API key is wrong. A message naming a domain means the From address is on a domain you have not verified.
535 Too many failed attempts or 421 Connection rejectedRepeated failed logins block your IP address for up to an hour. Fix the credentials, then wait before retrying.
Nothing arrives and no error is raisedEMAIL_BACKEND is still the console or file backend, so mail is printed or written to disk instead of sent. Set it to django.core.mail.backends.smtp.EmailBackend. With an eu_test_ key the send is accepted and shown in the dashboard but never delivered.
Connection times outYour host blocks outbound port 465, or the port is set to 587 or 25. eusend only accepts SMTP on 465. Ask your host to open it, or send through the HTTP API.

See the SMTP overview for the full status-code table.