I was having trouble sending email from my local development environment (OS X) via django’s send_mail, and thus smtplib.
I figured out I need to enable postfix for OSX following the directions here:
Except I had to do as a comment mentioned in the post, write each key/value as its own line, like so:
<key>RunAtLoad</key> <true/> <key>KeepAlive</key> <true/>
Check if postfix is running by typing sudo postfix status
If it’s not running, just start it: sudo postfix start
Now try connecting to it via localhost port 25
s = smtplib.SMTP('localhost') # or send_mail django.core.mail.send_mail(...)