1 Blog Entry tagged: testing
Testing Emails with Django
Django ticket #8638 titled, "Provide setting to disable e-mail sending", caught my eye as an interesting item to look into. As I looked into it, however, I came up with a pretty simple way to set up testing that involves some settings.py changes and about 4 lines of Python code.
The big piece of magic comes from Python's built-in smtpd library and the smtpd.DebuggingServer class, which discards all e-mails sent to it and prints them to stdout.
Let's use the class to create a local mail server that will discard and print all emails sent to ...