I had been looking for ways on how to unit test sending out emails via SMTP server. As with all other problems, there are a bunch of options for this. But most of them are not embeddable which means I have to start them and stop them outside my code. I was looking for something very simple. Something thats embeddable and provides just the bare minimum functionality that I need like asserting whether mails have been send (without actually sending them ofcourse!) and the content of the mail is actually what I intended to send. That’s how I hit upon Wiser or SubEtha SMTP.

The code itself is self explanatory: