How do you configure Django to send mail through Postfix? [closed] How do you configure Django to send mail through Postfix? [closed] django django

How do you configure Django to send mail through Postfix? [closed]


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

add this to your settings.py

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'EMAIL_HOST = 'localhost'EMAIL_PORT = 25EMAIL_HOST_USER = ''EMAIL_HOST_PASSWORD = ''EMAIL_USE_TLS = FalseDEFAULT_FROM_EMAIL = 'Whatever <whatever@example.com>'

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

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

myhostname = mybox.example.commydestination = localhost.server.com, localhost, example.com

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)