It’s always a bit annoying to send emails to your friends or your customers when you test a Web application, isn’t it?
To avoid that you can reconfigure your application or change the configuration of your postfix server but I’ve just found something easier and nicer:
sudo python -m smtpd -n -c DebuggingServer localhost:25
and all emails will be displayed in the console (use a port number above 1024 if you’re not root).
Originally published at sralab.com on February 27, 2009.