SharePoint 2013 not sending emails for things like mentions
Today I have been tasked with finding out why our SharePoint 2013 farm is not sending out emails to users when they are mentioned in news feeds, despite having the notifications enabled in the newsfeed settings:
SharePoint is configured to use our Exchange 2010 CAS cluster for outgoing mail. Some messages are sent successfully by SharePoint (such as alerts) but these were not arriving. So the first thing I checked was the Exchange message tracking logs to see if the messages were getting that far:
Get-MessageTrackingLog -sender "email@example.com"
This returned some results but as expected I could only see the emails sent by SharePoint for alerts and other notifications, there were no messages for the news feed mentions. Next I queried the SharePoint logs for my email address, after posting a test mention using, the Merge-SPLogFile cmdlet:
Merge-SPLogFile -Message "*firstname.lastname@example.org*" -Path C:\davemail.txt
In the log this entry stood our immediately:
Error: SmtpException while sending email: System.Net.Mail.SmtpException: Mailbox unavailable. The server response was: 5.7.1 Client does not have permissions to send as this sender
The Exchange SMTP log also showed that the message was being sent as the SP_PortalAppPool account and this user was being authenticated by Exchange. However, the sender address was not associated with this user in Exchange so the receive connector was not treating it as anonymous (the Exchange receive connector has the ‘Anonymous’ and ‘Exchange user’ permission groups allowed to send).
In conclusion I was able to make this work by creating an Exchange mailbox for the Service Account and adding the SMTP address that is configured for outgoing mail in SharePoint. It seems that SharePoint sends some messages anonymously and others are sent under the service account user context.