If you are getting “Connection refused” error message when trying to send an email from Django with send_mail then one thing to check is whether Postfix is running on your Mac OS X.
For that try the following in the terminal:
sudo postfix status
If Postfix is not running then start it.
postfix/postfix-script: the Postfix mail system is not running sudo postfix start postfix/postfix-script: starting the Postfix mail system
This should solve the problem (assuming email settings are correct). For example for localhost:
EMAIL_HOST = 'localhost' EMAIL_PORT = 1025
For debugging purposes you could use a local smtp server:
python -m smtpd -n -c DebuggingServer localhost:1025
Try to send an email with Django and you should see it in your terminal:
---------- MESSAGE FOLLOWS ---------- Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: Subject here From: firstname.lastname@example.org To: email@example.com Date: Sat, 28 May 2011 18:31:04 -0000 Message-ID: <firstname.lastname@example.org> X-Peer: 127.0.0.1 Here is the message. ------------ END MESSAGE ------------
You can find more info on testing Django email in the documentation.