Often times in development we work on projects that require email messaging. Many enterprise applications rely on email as a primary means of communication. Messages are dynamically generated by the application based on user interactions or system events. Informational email messages are sent to the end-user. User requests and system alerts are sent to support teams. Most corporations and software development firms have mail servers in-house or use the services of a web or email hosting service, which provides email. The protocol used by mail servers is SMTP (Simple Mail Transfer Protocol).
Developers are often restricting from using corporate mail servers to test emails during the development phases of a project. The mail server’s security settings, network configuration, or corporate security policies prevent development access. As an alternate, many developers install a mail server (SMTP server) on their local development computer. There are many options available for serving email at no a low cost or no cost. Configuring SMTP on the Windows platform with IIS is easy. Microsoft provides a fully functional SMTP service capable of managing email communications. However, if you develop on Windows, but not in .NET, Microsoft’s solution may not be your best choice.
If all you are all you are interested in is examining the email your application generates, there is an easier option – smtp4dev. This application, on CodePlex, was developed by Robert Wood. I’ve used it for the past two years for several projects, both .NET and Java, that required developing email notifications. Just download smtp4dev, unzip and place it in your programs folder, configure the port you want to use, and start it. The application is considered a ‘dummy server’, it will not actually send or receive email. It intercepts outbound messages, allowing you to view the results. It sits in the system tray. I’ve set up smpt4dev as a start-up item, it fires up each time I start my computer.
Below is a screen grab of smtp4dev running on my development computer. It contains emails I generated during the configuration and testing of Jenkins, while preparing my last post, Convert VS 2010 Database Project to SSDT and Automate Publishing with Jenkins – Part 3/3. I avoided all the issues of using fake email addresses and the potential risk of test emails actually being sent by a mail server. Raise your hand if this has happened to you!