Wednesday, July 17, 2013

SharePoint 2013 - Emails triggered from Workflows fail with HTTP 500


Symptoms

Consider the following scenario:
In an environment with SharePoint 2013 and Workflow Manager 1.0, we create a simple list, and using SharePoint Designer 2013, create a workflow with one action; "Send email to a User". We trigger the workflow on a list item in SharePoint as a non-system account (we cannot trigger it using 'system account').
In this scenario, the workflow goes to 'Cancelled' state on the item. The error in the popup window and in the [WFInstanceManagementDB].[dbo].[Instances] table looks like below:
RequestorId: 13e3b6bd-c114-58ae-4436-1a2bcd6a57d8. Details: System.ApplicationException: HTTP 500 {"Transfer-Encoding":["chunked"],"X-SharePointHealthScore":["0"],"SPClientServiceRequestDuration":["10"],"SPRequestGuid":["13e3b6bd-c114-58ae-4436-1a2bcd6a57d8"],"request-id":["13e3b6bd-c114-58ae-4436-1a2bcd6a57d8"],"X-FRAME-OPTIONS":["SAMEORIGIN"],"MicrosoftSharePointTeamServices":["15.0.0.4420"],"X-Content-Type-Options":["nosniff"],"X-MS-InvokeApp":["1; RequireReadOnly"],"Cache-Control":["max-age=0, private"],"Date":["Day, Time"],"Server":["Microsoft-IIS\/7.5"],"X-AspNet-Version":["4.0.30319"],"X-Powered-By":["ASP.NET"]}
at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)


Cause

- We grab the SPRequestGuid from the error for the workflow : "SPRequestGuid":["13e3b6bd-c114-58ae-4436-1a2bcd6a57d8"],"
- This is the correlation ID we need to look for in SharePoint ULS logs. And we saw below entries:

[Date and Time] w3wp.exe (0x1A6C) 0x15E8 SharePoint Foundation CSOM ahjq1 High Exception occured in scope Microsoft.SharePoint.Utilities.SPUtility.SendEmail. Exception=System.Net.Mail.SmtpException: Error in processing. The server response was: 4.7.0 Temporary server error. Please try again later. PRX2 at System.Net.Mail.DataStopCommand.CheckResponse(SmtpStatusCode statusCode, String serverResponse) at System.Net.Mail.DataStopCommand.Send(SmtpConnection conn) at System.Net.Mail.SmtpClient.Send(MailMessage message) at Microsoft.SharePoint.Utilities.SPUtility.SendEmail_Client(EmailProperties properties) at Microsoft.SharePoint.ServerStub.Utilities.SPUtilityServerStub.InvokeStaticMethod(String methodName, ClientValueCollection xmlargs, ProxyContext proxyContext, Boolean& isVoid) at Microsoft.SharePoint.Client.ServerStub.InvokeStaticMethodWithMonitoredScope(String methodName, ClientValueCollection args, ProxyContext proxyContext, Boolean& isVoid) 13e3b6bd-c114-58ae-4436-1a2bcd6a57d8

[Date and Time] w3wp.exe (0x1A6C) 0x15E8 SharePoint Foundation CSOM agmjp High Original error: System.Net.Mail.SmtpException: Error in processing. The server response was: 4.7.0 Temporary server error. Please try again later. PRX2 at System.Net.Mail.DataStopCommand.CheckResponse(SmtpStatusCode statusCode, String serverResponse) at System.Net.Mail.DataStopCommand.Send(SmtpConnection conn) at System.Net.Mail.SmtpClient.Send(MailMessage message) at Microsoft.SharePoint.Utilities.SPUtility.SendEmail_Client(EmailProperties properties) at Microsoft.SharePoint.ServerStub.Utilities.SPUtilityServerStub.InvokeStaticMethod(String methodName, ClientValueCollection xmlargs, ProxyContext proxyContext, Boolean& isVoid) at Microsoft.SharePoint.Client.ServerStub.InvokeStaticMethodWithMonitoredScope(String methodName, ClientValueCollection args, ProxyContext proxyContext, Boolean& isVoid) 13e3b6bd-c114-58ae-4436-1a2bcd6a57d8
[Date and Time] w3wp.exe (0x1A6C) 0x15E8 SharePoint Portal Server Microfeeds aizmo Medium SocialRESTExceptionProcessingHandler.DoServerExceptionProcessing - SharePoint Server Exception [System.Net.Mail.SmtpException: Error in processing. The server response was: 4.7.0 Temporary server error. Please try again later. PRX2 at System.Net.Mail.DataStopCommand.CheckResponse(SmtpStatusCode statusCode, String serverResponse) at System.Net.Mail.DataStopCommand.Send(SmtpConnection conn) at System.Net.Mail.SmtpClient.Send(MailMessage message) at Microsoft.SharePoint.Utilities.SPUtility.SendEmail_Client(EmailProperties properties) at Microsoft.SharePoint.ServerStub.Utilities.SPUtilityServerStub.InvokeStaticMethod(String methodName, ClientValueCollection xmlargs, ProxyContext proxyContext, Boolean& isVoid) at Microsoft.SharePoint.Client.ServerStub.InvokeStaticMethodWithMonitoredScope(String methodName, ClientValueCollection args, ProxyContext proxyContext, Boolean& isVoid)] 13e3b6bd-c114-58ae-4436-1a2bcd6a57d8

- From the stack it looks like a communication error with the Outgoing SMTP server.


Resolution

Verify the following settings:

- We made sure the Outgoing Email settings for the farm are set correctly.
- We made sure that from the SharePoint server - we are able to telnet the Exchange server on port 25 and there is a positive response status for EHLO request.
- We disabled firewall on the Exchange/SMTP server.
- We also ensured App management service is running, UPA is set up and we have completed sync such that the user running the workflow has a profile.

1 comment: