Thursday, February 9, 2012

Sending Emails using SendEmailRequest

When you want to send emails through CRM 2011, it is important to set the IssueSend boolean field explicitly.
Because the default value is false, and if the value is false, CRM marks the email as 'Sent' but CRM 2011 does not send the email. So if you want to fire the email to end user, you must set the IssueSend field to true

1. Method 01
//The below code will mark as the email as 'Sent' but CRM 2011 will not send the email to the relevant user
SendEmailRequest sendEmailRequest = new SendEmailRequest { EmailId = emailId, TrackingToken = ""};
2. Method 02
//The below code will mark as the email as 'Sent' but CRM 2011 will not send the email to the relevant user
SendEmailRequest sendEmailRequest = new SendEmailRequest { EmailId = emailId, TrackingToken = "", IssueSend = false};
3. Method 03
//The below code will attempt to send the email to the relevant user
//And if it success, CRM 2011 will mark the email as Sent
SendEmailRequest sendEmailRequest = new SendEmailRequest { EmailId = emailId, TrackingToken = "", IssueSend = true};

No comments:

Post a Comment