SharePoint 2013 Incoming Email Issue : Emails disappear



The other day we had a SharePoint 2013 development environment which had been configured up to receive email into libraries.

The configuration had been working for a while with no problems, there are issues with the incoming email on older versions of SharePoint 2013 but this farm was patched to May 2015.

We used the following Technet article to configure incoming email:

Unfortunately, email was never getting into SharePoint. The service had been working without any problems for a few weeks.


Problem Analysis


On investigation of the problem showed that email was successfully routed via Exchange to the SharePoint server via the locally installed SMTP service. The email was arriving successfully into the drop folder and after a few minutes the email disappeared. However, it would never appear in the document library! The email just disappeared.

Another symptom of the problem was seen when accessing the document library settings page for Incoming Email. Not all the settings would be loaded, the page was missing a large set of settings.

Normally the page looks like this :-



However, it was only showing this information :-



When someone attempted to make a change to the email settings for the list then the following error would be thrown:-

Server Error in '/' Application.

Error in the application.Description: An unhandled exception occurred during the execution of the current web request. 

Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: Microsoft.SharePoint.SPException: Error in the application.

Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: [SPException: Error in the application.]   
Microsoft.SharePoint.SPList.UpdateDirectoryManagementService(String oldAlias, String newAlias) +1239   
Microsoft.SharePoint.SPList.Update(Boolean bFromMigration) +311   
Microsoft.SharePoint.ApplicationPages.EmailSettingsPage.SubmitButton_Click(Object sender, EventArgs args) +1347   
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +146   
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3586

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34248


Strange behaviour indeed!

I fired up ULSViewer ( on the offending server. Whilst watching the ULS log, another email was sent to the document library. After a minute or so a message popped up.

Cannot load type EWSSharePointEventReceiver from Assembly: [Assembly Name].

So for some reason the assembly could not be loaded, hmm so why is that?
I had a look through the GAC and could find the assembly name. However, using a .Net Reflector such as Just Decompile ( or .NET Reflector ( I could see that the class was not in the assembly. Speaking with the developers, I found out the class names had been changed. So the next thing I checked was the event receivers.

With a bit of PowerShell, I found a set of event receivers which were being fired by the item email received event.

I removed the event receiver using the following PowerShell and running it in the SharePoint 2013 PowerShell Management Shell:-


$site = Get-SPSite $siteUrl;
$rootWeb = $site.RootWeb;
$allWebs = $rootWeb.AllWebs();

foreach($checkList in $allListsInWeb)        
	Write-Host "Checking List: " $checkList.Title " for event receiver class: " $eventReceiverName;
	$eventReceivers = $checkList.EventReceivers | ?{$_.Class -like $eventReceiverName};            
        If($eventReceivers -ne $null -and $eventReceivers.Count -gt 0)
             foreach($removeReceiver in $eventReceivers)                        
	           Write-Host "Removing Event Receiver: $removeReceiver";


After the corrupt event receivers were removed from the list then resending the email to SharePoint worked! Now the email appeared in the document library.

Thoughts? Comments about this post? Please leave them here..

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.