Wednesday, August 6, 2008

More e-mail blues

I have put off wrestling with the particularly pesky (buggy? broken? useless?) SendEmail activity today, and found (to make a long story short):
  1. There is no way on earth (it seems) to properly set the correlation token of a SendEmail activity nested within a custom composite activity. Thus, it is incompatible with the most important abstraction mechanism provided by WF, thus it is not useful for development of complex workflows.
  2. Both the SendEmail activity and the "ability" to notify users of tasks via email (taskProperties.SendEmailNotification == true) are known to throw the workflow-terminating error "The e-mail message cannot be sent. Make sure the outgoing e-mail settings for the server are configured correctly" on some servers with properly-configured email settings.
I found the aforementioned error message to be thrown by my workflow when:
(the workflow was coded to copy data from my initialization form to my task forms) and ( (the tasks were set to send e-mail notifications) or (my SendEmail activity nested within my custom sequential activity was Enabled) ).
If the workflow was _not_ coded to copy data my initialization form to my task forms:
  1. Upon building the project, I get the following warning:
    "Activity 'sendRejectionEmail' validation warning: The correlation may be uninitialized."
  2. Upon starting the SendEmail activity, the workflow crashes with error message:
    ""
I tried adding an OnWorkflowActivitated activity to my custom sequential activity, and I set it and the SendEmail activity to the same correlation token. This time,
  1. The aforementioned warning goes away! (Maybe I'm onto something!)
  2. The workflow hangs (never assigns the first task even), and one of the w3wp.exe processes takes up 25% system resources (all it can get in a single thread on a quad-core processor, as is the case with this server).
Between this post and my previous one, I think I have made a good case that one should _not_ expect the OOB SendEmail activity to work.

1 comment:

brad said...

Hey, Did you ever figure this one out? If not what workaround did you utilize?

Thanks,
Brad