Monday, May 18, 2009

How to set up a development smtp server for Django

A cool feature in Django is the development server. It allows you to quickly test your code without dealing with a full blown Apache/web server deployment. When i played with the django-registration, i needed also a "development" SMTP server (during the registration process, an email is sent to activate a new account). Luckily, this is simple enough to do with python. Open a new console and type:


python -m smtpd -n -c DebuggingServer localhost:25

And you'll have a "fake smtp" server. All it does is to listen for smtp connections, and just dump the smtp data to the console (no real emails are sent).

No comments:

Post a Comment