I have been trying to find a good solution for a test SMTP server for SharePoint for some time. Like many others, I have unique requirements including: 1) I run a SharePoint development instance on my Windows 7 laptop, 2) I run SharePoint test instances on virtual machines, and 3) I do many SharePoint demos from my laptop — sometimes without an internet connection. Since SharePoint requires you to use a SMTP server that allows anonymous access, that somewhat limits one from using an ISP account as well. It is frustrating to demo a workflow without the ability to send an email.
I recently discovered an open source solution for developers that captures SMTP traffic on the developer machine and doesn’t actually send it. This works perfect for demos for me. The solution is called smtp4dev. Here is how it works.
Once you have downloaded and installed smtp4dev from codeplex.com, double-click the icon in the system tray and click the options button on the dialog that appears. Switch to the server tab and put your computer name in the Domain Name field. Note that the smtp4dev instructions suggest that you use localhost which in most cases would be fine. However, in the Outgoing Email Settings in SharePoint, I received an error saying the localhost smtp server could not found. I got around the error by naming the domain and smtp server the same as my workstation.
Once you have smtp4dev configured on your SharePoint server, open up SharePoint’s Central Administration. Go to Manage web application –> highlight your web application –> General Settings –> Outgoing Email. Simply provide an email address and “localhost” as your email server.
After that, you are good to go! I opened up a calendar on my SharePoint 2010 Team Site and added an alert. It really doesn’t matter to whom the alert would be sent as this tool intercepts all outgoing emails from your test server. Then I added an event to my calendar. A few seconds later, the smtp4dev icon in the system tray notified me that it had intercepted an email. I double-clicked on it, and voila!
When I double-click on the email message in smtp4dev, Outlook opens on my workstation displaying the alert email.
It’s that easy! I saw one report that smtp4dev would not work when you do not have a live internet account. However, I disabled the wireless interface on my laptop and it still worked for me just fine. From what I can tell, this is going to be perfect for doing SharePoint demos. I’m sure I’ll use it for years to come. I want to think Robert Wood for contributing this excellent solution.
Since publishing this post, I have recently become familiar with another option for testing outgoing email. Please see the new post here on Papercut.