Developing with DevNullSmtp mailserver

When you are developing a .NET website with e-mail functionality you often want to test the mails your code is sending. Often you can use a SMTP mail server within the domain, but you’re always have to worry about not sending test e-mail to the outside world. Alternatively you could setup your own mail server somewhere, but getting everything in place and configured is not always easy.

Lately I started using DevNullSmtp mailserver for developing mail applications. It’s purpose is simple: catch the mail sent to port 25, log the message and destroy it (hence the name DevNull). It has a graphical user interface and also command line options. Btw, you need Java runtime installed on your PC to run DevNullSmtp. The GUI:

smtpdevnull

 

You can see that I use the default SMTP port 25. After sending mails, you can use the four tabs to inspect the mail actions. You can view the SMTP logs for mail instructions or just keep an eye on the last message (like shown above).

You can see that the mail is a multipart mail which contains rich HTML markup. To check the mail in a mail program like Outlook, you have the option to save incoming message in a folder as .eml files:

DevNullSmtp2

This is a very useful options to verify the look and feel of HTML e-mail. I always have this check enabled via a batch file start.cmd :

"C:\Program Files (x86)\Java\jre6\bin\java" -jar DevNullSmtp.jar -p 25 -s emails

Have fun e-mailing,