Jure Cuhalev

03 Dec, 2009

Python SMTP sink server

Posted by: Jure Cuhalev In: django|Tech

Debugging email sending in your Web application is always tricky as you need a working SMTP and you also need to watch out that you don’t accidently spam real users (if you’re working on a local copy of real database).

There is a neat one liner that acts as a “sink smtpd” server, meaning that it implements SMTP protocol, so you app can communicate with it, while printing everything it receives on screen:

sudo /usr/lib/python2.6/smtpd.py -n -c DebuggingServer localhost:25

(via Django Snippets)

2 Responses to "Python SMTP sink server"

1 | Nicolas Toper

December 3rd, 2009 at 9:57 am

Avatar

For this purpose, also you can use our SMTP gateway. We have a sandbox mode.

Granted, it might easier to debug in localhost :)

I would be curious about your feedback on our overall app

2 | gasper_k

December 3rd, 2009 at 11:39 am

Avatar

Fakemail is a similar thingy, comes in PHP an Python version. It can dump everything (headers included) to a file in a specified directory, useful for unit testing.