Jure Cuhalev

03 Dec, 2009

Python SMTP sink server

Posted by: Jure Cuhalev In: Tech| django

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)

Related posts:

  1. Django and YUI time
  2. Posting to Koornk using Python
  3. Listing all keys in S3 bucket using python boto
  4. Django cleaned_data
  5. MSN Live Search python API access

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.

Flickr PhotoStream

    Visualizing Slovenian IT tax spendingMuffins in the makingWorkspace

About

jure100px_colour Jure Cuhalev is an Open Source Hacker, with background in Social Sciences and Usability and User Experience (UX).