I have a workflow with a send email activity following a code block. This is code block :

private void codeActivity2_ExecuteCode(object sender, EventArgs e)
    this.sendEmail2.To = "[email protected]";
    this.sendEmail2.From = "[email protected]";
    this.sendEmail2.Subject = "Expense Report Approved";
    this.sendEmail2.Body = "Your Expense Report:1";

But no email gets sent and no error messages generated.

It works when I directly complete the same four fields in the properties of the send email activity (without code block)

Any ideas, do I need to submit the email when using code block? In the code I've tried without the 'this' command also.

1 Answer 1


If you use code activity to set properties of send email activity, the email is sent when email activivty is executed. In this case you need to be sure that code activity is invoked first. You can create empty method for send email activity, put break point to this method and check what properties send email activity has.

  • Hi Do you mean ctraye a MethodInvoking within the Email Activity by double clicking activity and generating private void SendEmailResponse_MethodInvoking(object sender, EventArgs e) { } Commented Jan 11, 2012 at 9:14
  • yes. in this case you can check the activity properties before this activity is executed.
    – Alexander
    Commented Jan 11, 2012 at 9:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.