We experienced a very frustrating issue with sending emails in SharePoint 2007 custom workflows. The error we received was
The e-mail message cannot be sent. Make sure the outgoing e-mail settings for the server are configured correctly.
First, a little background…
We had assigned a number of tasks upon employee termination, such as “Collect badge”, “Revoke UNIX access”, etc. There were about a dozen of these tasks assigned when the termination was entered. When each task was assigned, a separate workflow was initiated to send the email to the person responsible for completing the task. For example, someone in the Facilities group was responsible for collecting the employee’s badge. The majority of the time, the email was sent and the logging indicated success.
… but sometimes, we received the error and could not determine why. The issue was sporadic. Sometimes all 12 emails would be sent successfully. Other times, maybe 2 or 3 emails would fail – never consistently the same workflow processes.
Is it possible that with this many emails we had a conflict issue of some sort? Maybe… but 12 concurrent emails doesn’t seem to be an unreasonable number!
A quick look at the SharePoint logs during the time of the issue did not point us to an obvious problem with the workflow logic or the email settings.
We stumbled upon a work-around quite by accident…
One of our workflows worked a little differently. We had it set up to pause for some time after the initial email attempt. It was in this process where we found that if the email was not sent properly, then within 30 minutes or so after the pause, the SharePoint timer job kicked in and took action. The timer job determined there had been an issue and restarted the workflow from the top, rerunning the logic to send the email. With the delay built in, that workflow never had an issue sending the email.
This prompted us to add a 2 hour delay at the end of all of our email workflows to ensure we had plenty time to get the email sent appropriately.
The 2 hours is probably overkill, as it seems to consistently require only 30 minutes or so to eventually send the email (the timer job gets kicked off in our shop every 30 minutes). Since there is no additional processing after the pause, it doesn’t hurt to include it in the logic.
A simple delay fixed our issue! Since we have added the delay, all emails have been sent.
0 Responses to “Getting failed emails to send in SharePoint 2007 custom workflow”