SharePoint Developer box configured with email send/receive capability using SMTP Service + Visendo SmtpExtender

So you are one of those guy who want to setup a simple email send/receive capability to test various SharePoint notification mechanism for bunch of domain users.

The following were configured and tested in an environment of:

1. Windows Server 2012 R2 + Active Directory Installed + Required users added.

2. SharePoint 2013

3. Outlook 2013 client

Steps:

1. First of all you need to configure SMTP service in your dev. box.

https://technet.microsoft.com/en-us/library/cc263462%28v=office.15%29.aspx

Note: Though you have an engine which can forward messages across, you still don’t have the POP3 service available within your box (the POP3 service no longer comes with windows server, which was available back in those days when Windows Server 2003 was there).

so how do you get that as most of your client would look for POP3 at a minimal. this is where the Visendo comes into play (btw, if you want to really configure a fully fledged server go ahead and try the exchange server, but for development purposes you really don’t want to spend time configuring exchange isn’t it?.

Test whether the SMTP service is ready before moving to next step – :

2. Install the Visendo following the steps marked in here (the version I used was V1.1.2.637 Demo x64)

Refer to the manual I used here – https://www.dropbox.com/s/y54mkpojerlxfv6/VisendoSmtpExtender_manual_en.pdf?dl=0

The installation binary is here –

https://www.dropbox.com/s/wbrs0wu804xadql/VisendoSMTPExtender_Plus_x64.msi?dl=0

 

My setting for a test user tariqa@readylab.net is as follows:

image

image

Any settings you play with either Visendo / SMTP service, you need to restart both services

To restart Visendo service (click the Settings top tree node in the UI):

image

To restart the SMTP service:

WIN + R > Services.msc  > Look for “Simple Mail Transfer Protocol (SMTP) (right click and restart):

image

 

By now I am assuming that you have added necessary users to the Visendo to try the next step:

3. Configure outlook mail client to send/receive emails (since the idea is to test send/receive email for multiple users, I have set the configuration of outlook mail to prompt to choose the profile at start up):

How to make outlook prompt to choose profile:

image

image

 

Now to configure my test user tariqa@readylab.net, follow the screenshots:

image

image

image

 

image

 

image

 

Tested sending and receiving emails from/to outlook client:

image

 

Finally Testing the whole with SharePoint:

$email = "tariqa@readylab.net" $subject = "SharePoint routed email test" $body = "Email test body.. yey yey" $site = New-Object Microsoft.SharePoint.SPSite "http://pwcs.com.au" $web = $site.OpenWeb() [Microsoft.SharePoint.Utilities.SPUtility]::SendEmail($web,0,0,$email,$subject,$body) // A True or False will confirm the message has been sent or not

 

Throw it all to a console:

image

 

Observation/outcome:

1. Worried since the email did not come to outlook Sad smile, then started the usual check at the drop folder location:

– Found an unserved .eml reflecting the time that the email was sent. – wait.. just disappeared, hmm… just now the batch processing got invoked

2. now the email is received at the outlook end.

image

 

Happy configuring….

Some useful links I referred:

http://weblogs.asp.net/hpreishuber/free-pop3-for-windows-2012-server

http://www.visendo.com/download/visendosmtpextender/docs/VisendoSmtpExtender_manual_en.pdf

http://blogs.perficient.com/microsoft/2010/11/email-configuration-within-a-sharepoint-2010-development-environment/

http://www.falconitservices.com/support/KB/Lists/Posts/Post.aspx?ID=105

https://technet.microsoft.com/en-us/library/cc732046%28v=ws.10%29.aspx

http://blogs.msdn.com/b/pareshg/archive/2010/04/23/how-to-configure-incoming-and-outgoing-emails-in-sharepoint-server-2010.aspx

http://webvaultwiki.com.au/(S(02oa34jugewqyznj3f0qg1q3))/Default.aspx?Page=Switch-Between-Multiple-Outlook-Profiles&NS=&AspxAutoDetectCookieSupport=1

Sending email from SharePoint on-premises via Office 365 – Client SMTP Submission

Installing a local SMTP Relay

The first step is to install an IIS SMTP server that will be used for relaying messages from SharePoint. This can be accomplished by using the ‘Add Roles and Features’ wizard, after completion will add a new option “Internet Information Services (6.0)” in the Server Manager ‘Tools’ menu. This is the interface by which we’ll configure the SMTP server, pictured below:

 

Configure SMTP Virtual Server Settings

By default the server listens to all addresses on port 25 which is the default SMTP server port, and Anonymous access is enabled; no changes are required to either of those items for our scenario. However, to ensure that we don’t relay messages from any machine we’ll limit the systems that are able to connect to and send through our server. From the “[SMTP Virtual Server #1] > Properties > Access” tab, click the “Connection” button which brings up the following window:

 

Be sure to specify the IP Address of each of the servers from which messages will be sent. Typically, multiple IP addresses are bound to each SharePoint server to support SSL bindings – be certain to list each of the addresses. In this screenshot, we’ve configured the SMTP Server to allow connections from two of our SharePoint servers.

Next, we’ll also ensure that only our two systems are allowed to relay messages through the SMTP server, which is accomplished by clicking on the “Connection” button on the same “Access” tab of the server properties. Note that we have the same two IP addresses listed, allowing only those two machines to relay:

 

From here, we need to configure the Office 365 mailbox username/password that the SMTP Server will use when sending messages. This is configured in the “Delivery” tab, using the “Outbound Security” button. Be sure to enter valid credentials for your Office 365 user, and if it’s a newly-created user make note that you’ll need to change the initial password on first login. If you don’t do this, mail will not send despite your best efforts!

 

Next we need to tell the server to use TCP port 587 when attempting to connect to Office 365, which is set in the “Outbound Connections” option of the “Delivery” tab:

 

Lastly, we need to specify which server to send mail through, and we do this by clicking the “Advanced” button on the “Delivery” tab. Be sure to specify the smart host as smtp.office365.com and clear the option to “Attempt direct delivery before sending to smart host”: this will ensure that all outbound mail will be sent via Office 365:

 

Configure Outgoing E-Mail Settings in SharePoint

Finally, we need to let SharePoint know about our new SMTP Server, which is done via Central Administration > System Settings > Outbound E-Mail Settings, as pictured below. Note that I’ve blurred out the values to protect the innocent, but you need to be certain to specify the servername, and your Office 365 mailbox user in the From address.

 

At this point, we’re ready to test our configuration and we’ll use PowerShell on the SharePoint server to do so. This way we can be sure that each component in our configuration is working, from the SharePoint settings through to the Office 365 mailbox. Open a SharePoint Management Shell and run the following PowerShell snippet:

$sdo = new-object System.collections.specialized.stringdictionary $sdo.add("to","raymond@dynamicowl.com") $sdo.add("from","sharepoint@office365domain.com") $sdo.add("Subject","Test message from SharePoint") $web = get-spweb "https://intranet" $messagebody = "This is a test message from SharePoint on-prem" [Microsoft.SharePoint.Utilities.SPUtility]::SendEmail($web,$sdo,$messagebody)

The output of the command will return “True” (and you’ll receive an email message) if it was successful; “False” indicates that something has gone wrong and the message was not delivered.

When things go wrong

In our experience, there are a few items that you’ll want to verify if outbound email is not flowing as expected, including:

  • the SMTP Server service is set to “Manual” start by default; be sure to change this to “Automatic” so that the service starts upon a reboot of your server
  • the Windows Server may require a server certificate in order for TLS to be used; this will generate an error in the Event Log and be evidenced by the SMTP Server Properties “Secure Communication” section of the “Access” tab indicating that no certificate can be found for TLS

Conclusion

E-mail is still a critical communication method in today’s business world, and moving email services to the cloud is more common than ever. We can still send email from an on-premises SharePoint server via Office 365 by setting up a local relay and sending mail from an Office 365 mail-enabled user.