Testing Outgoing emails on SharePoint…

This blogs holds good for SharePoint 2010 & 2013. Maybe this will work as is on SP2016, so far never tested though!

I’m sure most of the SharePoint Admins, in some part of their career have dealt with those strange Alert issues with SharePoint

Well, I do this quick test to see if the emails can work outside SharePoint, before digging inside SharePoint

The key to troubleshoot any issue is to Isolate.. The mantra is “Isolation leads to…. Resolution”

If you working on Outgoing email alerts from SharePoint, then it will be a good idea to first test the email functionality outside SharePoint

If the emails cannot work outside SharePoint, it will definitely not work inside SharePoint

Open SharePoint PowerShell as Administrator, and run the below PowerShell script:

$caWebApp=(Get-SPWebApplication -IncludeCentralAdministration) | ? {$_.IsAdministrationWebApplication -eq $true}

$SMTP= $caWebApp.OutboundMailServiceInstance.Server.Address

#In this case, we are getting the Outgoing SMTP Server details from SharePoint Central Admin.

#Or, you can directly enter the SMTP Server name as:

#$SMTP=mail.contoso.com instead of $SMTP= $caWebApp.OutboundMailServiceInstance.Server.Address

$Subject = “Outgoing Email Test”

$To = “admin@contoso.com”

$From = “SharePoint@contoso.com”

#Once all variables are set, then run the below command:

    send-mailmessage -from $From -to $To -subject $Subject -BodyAsHtml “Test this” -priority High -dno onSuccess, onFailure -smtpServer $SMTP

If the outgoing email is successful, then on the client Mailbox, in this case admin@contoso.com you should get an Email with subject line: “Outgoing Email Test”

If no email is received, then no point in checking the SharePoint ULS logs to understand why emails are not going via SharePoint

At this point maybe you should engage your Exchange Team to see why emails are not being sent from the SharePoint Server, maybe SMTP Port-25 is blocked on this server

If you have received the email successfully, then be sure enough that the SharePoint Server on which you ran the PowerShell commands to test emails, this SharePoint Server can send emails successfully

If you are working on a Multi-Server farm, let’s say Two Web Servers and Two App Servers, there could be a scenario that emails work occasionally, then probably you are hitting an issue where one or more Servers in the Farm is unable to send the Emails.

In this case, run the same PowerShell script on every Server in the Farm which participates in sending outgoing email and pin point which is the problem Server

Hope this helps!

 

Leave a Reply

Your email address will not be published.