E-mails sent from Django appear as webmaster@host.domain.tld

Overview

E-mails sent from a Django application may use “webmaster@host.domain.tld” or another erroneous address as the From field.

Cause

ServerAdmin values are not set in Apache configuration for virtual hosts to prevent unintentional information leakage.

Solution

Set DEFAULT_FROM_EMAIL and SERVER_EMAIL in your Django settings file. An example configuration follows:

EMAIL_HOST='localhost'
EMAIL_PORT='587'
EMAIL_HOST_USER='myadmin@mydomain.com'
EMAIL_PASSWORD='mysmtppassword'
DEFAULT_FROM_EMAIL=EMAIL_HOST_USER
SERVER_EMAIL=EMAIL_HOST_USER

Replace EMAIL_HOST_USER and EMAIL_PASSWORD values with your correct e-mail credentials.

See also

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.