Categories
Programming

One Way To Never Send An Email From Your Test Environment

If you have software that generates emails, you’ll want to test it without risking sending an email to a real address. Of course, your test environment is full of fake accounts with safe email addresses and you know that you should avoid cutesy test data because it leads to trouble – but there will always be a risk if you hook up a real SMTP server to your test environment (for example, that usability testing you run where a non-software-professional gets to type in whatever they like).

That’s why I wrote a Fake SMTP Server that can run as a Windows Service or a Console App.

The SMTP Stub application can either discard every email it receives, or you can ask it to log the raw email messages to a directory of your choice. You can specify a limit if you are storing emails, so it will only keep the most recent emails.