Django / Postfix — Connection Refused on send_mail on OSX

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:
http://www.agileapproach.com/blog-entry/how-enable-local-smtp-postfix-os-x-leopard-0

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(...)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s