How to Change the RetryDeliveryInterval for SharePoint 2010


SharePoint 2010 introduced several new APIs in SP1, one of which is the RetryDeliveryInterval on the SPIncomingEmailService class.  This value represents the number of hours the incoming email service will attempt to process an invalid email message in the drop folder before the email message is permanently deleted.  The primary reason an email message would be invalid would be it has a no valid recipients. 

Specifically, this property is used to determine if the current time minus the email message creation time is greater or equal to the current time minus RetryDeliveryInterval.  If the message is older, it is deleted and not re-processed during the next job execution.  If you know you have large amounts of incoming email being delivered to a SharePoint farm that has invalid recipients, reducing this number from 24 hours (default value) to a smaller number will force “invalid” emails to  be deleted more frequently.  This can help alleviate a back log of email invalid email messages being stuck in the drop folder.

To modify this property, open a SharePoint Management Shell window and execute the following PowerShell, substituting your desired value for RetryDeliveryInterval:

$emailSvc = Get-SPServiceInstance | WHERE { $_.TypeName -eq "Microsoft SharePoint Foundation Incoming E-Mail"} Current Value: $($emailSvc.Service.RetryDeliveryInterval) $emailSvc.Service.RetryDeliveryInterval = 1 $emailSvc.Service.Update()

To set this value back to the default value, execute the following:

$emailSvc = Get-SPServiceInstance | WHERE { $_.TypeName -eq "Microsoft SharePoint Foundation Incoming E-Mail"} Current Value: $($emailSvc.Service.RetryDeliveryInterval) $emailSvc.Service.RetryDeliveryInterval = 24 $emailSvc.Service.Update()