Python SMTP sink server

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 thoughts on “Python SMTP sink server

  1. 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. 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.

Comments are closed.