Chandler Chao

I have a custom VS workflow that has two Send Email activities. One is sent after the onWorkflowActivated activity (before a task is created). The second email is after the Task Completed activity and right before termination of the workflow.

Both activities have identical properties except for their Headers and Body; I set those two properties in their Invoking methods.

The first emails is sent out without issue. The second one is reported by Sharepoint to fail with this message:

The e-mail message cannot be sent. Make sure the outgoing e-mail settings for the server are configured correctly.

I can step through the invoking method of that second email without error. The error is obviously happening after the invoking code. There are no failed messages in the mailroot tree of the server either.

I'm a bit confused. Can anyone help


Re: SharePoint - Workflow Second Workflow email failing

MarkAtDLC

I ran into this exact problem on my first implementation of a workflow with multiple email activities. I would like to say that I figured out exactly what went wrong, but I can't - it almost had me pulling my hair out. I ended up deleting the second email activity, copying the first to it's place, running the workflow to test that it actually sent 2 emails as it should (it did) and changing the properties of the second email activity one by one, repeating testing each time, until it was correctly configured. After I got it correctly configured I could not see any differences from the original second email activity.

If you do find an answer, could you post it

Good Luck




Re: SharePoint - Workflow Second Workflow email failing

Chandler Chao

It is quite obviously a very flaky activity. Since the code to do it manually with System.Net.Mail is quite simple I just elected to replace both Email Activity with Code Activities that essentially do the same exact thing. Worked like a charm.

I think I'm going to steer quite clear of that Email Activity for quite some time. Definitely an added frustration that one doesn't need when working with workflows.





Re: SharePoint - Workflow Second Workflow email failing

Aaron A

I was receiving the exact same error message in my workflow with my send email activity. I think the problem is something with the invoking code. If you bind the header / cc / bcc / from / to / body / subject, etc. to a field and then set the field in the invoking method, it works, or just setting the property value directly in the property of the activity.

What was weird was when my send email activity happened a second time (the exact same activity), it sent the email.

my state workflow is something along the lines of:

approval state

approve -> next approval state

or

reject -> rejection state (send email to notify of rejection [error] and then modify or delete item event activities)

on item change -> go back to approval state -> if it's rejected again it goes back to the rejection state with the same email activity [successful send]

since then I have bound my to and body properties to a field and set them that way, instead of using

Code Snippet

sendEmail1.To = "nobody@somebody.com" or name.email; // name being an SPUser

sendEmail1.Body = "whatever your string is";





Re: SharePoint - Workflow Second Workflow email failing

Stephan85

Hi Guys,

Did you have found a solution to this matter I have sadly the same problems... Sad Isn't this a thing for Microsoft to investigate

Greetz,