Testing Email In Your Web Application

By June 20, 2014 asp.net, code

Often times when you are building a new web application which supports sending out email confirmations or error notifications you want a simple way to test the message is sent correctly. A great tool to test locally on your development machine is to use a dummy SMTP server to which your application can deliver mail but not relay to the actual recipient.

One such tool is smtp4dev.  Per the project description:

Windows 7/Vista/XP/2003/2010 compatible dummy SMTP server. Sits in the system tray and does not deliver the received messages. The received messages can be quickly viewed, saved and the source/structure inspected. Useful for testing/debugging software that generates email.

You can pick up the installer at http://smtp4dev.codeplex.com/

Once installed, run the smtp4dev application and change the SMTP address of your locally running web application to point to the dummy SMTP server (usually just localhost).

On a side note, I was reviewing a new tool to manage an ASP.NET Membership database and came across an interesting nugget of information in my review.

If you have a Gmail account, you can “create” and test multiple addresses by adjusting the Gmail address by appending a +xyz to your name. For example, if your actual address is mynamehere@gmail.com then you can also use mynamehere+roleone@gmail.com or mynamehere+123@gmail.com and all messages will end up in your main mynamehere@gmail.com account.

Found the above on Brock Allen’s MembershipReboot project on GitHub.

Some links surrounding projects by Brock:

Introducing Thinktecture IdentityManager

Thinktecture.IdentityManager as a replacement for the ASP.NET WebSite Administration tool