Testing e-mail sending locally in Django

If you’ve been wanting to test email in your Django application locally, then read this short tutorial.

If you need to test you Django app’s email sending functionality locally, you’re in luck. Python has a built in “dumb” SMTP email server for doing just that.

All you need to do to run it is open up your console and type:

python -m smtpd -n -c DebuggingServer localhost:1025
Then just change your settings.py file to have these settings:
EMAIL_HOST = "localhost"
EMAIL_PORT = 1025
… and any email sent from your local Django app will show up in the console for you to view.

See this page for more info: http://docs.djangoproject.com/en/dev/topics/email/#testing-e-mail-sending

Hope that helps, cheers!

Published November 21st, 2009 by Dana Woodman in Reference
Tags , ,
Comments 1 Comment »

  1. Adones Cunha 5:04 am @ February 5th, 2010   #

    Thank’s for this tip.