SMTP4DEV - SMTP Server Tool to Test SharePoint 2013 Ougoing E-Mails

What is SMTP4DEV?
Well, SMTP4Dev is a nifty tool for capturing and testing Emails from any application. It doesn't actually send any Emails to actual recipient, but it captures Emails triggered from applications such as SharePoint. Here is how we can utilize this tool for testing outgoing Emails from SharePoint.

This is extremely helpful in development environments and for testing purposes.

Step 1: Download SMTP4DEV tool from Codeplex
Download the SMTP4DEV tool from codeplex: Standalone also available.! Just click and run the tool.

Step 2: Set Domain name in the tool
This tool runs from system tray area. The first thing you have to set is: configure the domain name as your current server name (by default it will be localhost). 
  • Go to options >> Under the Server tab, set the domain name accordingly.
    smtp4dev sharepoint 2010

Step 3: Configure the Outgoing Email settings in Central admin
Now in SharePoint 2013 (or in SharePoint 2010), set the outgoing email settings from SharePoint central administration site.
  • Central Administration >> System Settings >> Configure outgoing e-mail settings >> add the same machine name in smtp4dev
    smtp4dev sharepoint 2013
Make sure that the domain name provided in smtp4dev tool and the Outgoing Email settings in SharePoint central Admin are same.

Step 4: Write code / Set Alerts in SharePoint to trigger E-mails
Now, You can write your custom code/event receiver/workflow/Create alerts to send Emails from SharePoint. Here is my sample code to trigger Email with SPUtililty.SendMail using PowerShell:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$siteUrl =""

$Web = Get-SPWeb $siteURL
$mail = [Microsoft.Sharepoint.Utilities.SpUtility]::SendEmail($web,0,0,"[email protected]","Subject of the Mail","mail body")

Here is the output:
As soon as an Email triggered from SharePoint, This tiny tool starts blinking and you should see messages appear in SMTP4Dev!
smtp4dev sharepoint
You can inspect the Email from the tool and open mails with any Email client such as Outlook.

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.