toothie toothie - 1 year ago 110
Python Question

How do you configure Django to send mail through Postfix?

How do you configure Django and Postfix to send emails for Django apps?

I am able to do it using Gmail server settings but I want to send email from my own server using my own domain.

Answer Source

I banged my head a lot before realizing that it is actually quite simple:

add this to your

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'localhost'
DEFAULT_FROM_EMAIL = 'Whatever <>'

Also make sure that a fully qualified domain name (say is set up on your server (how),

Then you need to have in you /etc/postfix/main.cnf these lines:

myhostname =
mydestination =, localhost,

Also you have to set up proper MX record for your domain (check here) in your dns server (and in your registrar, if you handle dns lookup through you them)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download