Trying to send emails via CRM API

It looks like MS CRM 4.0 API doesn’t allow you to try to send an email.

You can create an email, of course, like this:

email ResellerEmail = new email();
//filling dozens of parameters
Guid emailID = service.Create(ResellerEmail);

This only creates an email in the database, but not actually sending anything. In order to send you have to run something like this:

SendEmailRequest req = new SendEmailRequest();
req.EmailId = emailID;
req.TrackingToken = string.Empty;
req.IssueSend = true;

But you don’t know for sure if the email is going to be sent. May be you don’t have a valid e-mail address, may be the contact with this email address has “Do not spam” flag on. If any of those happen, the service.Execute just throws an exception and the program is stopped.

Either you have to check all e-mail validity parameters yourself or to catch the exception. Pity, it should just return an error code or something.

You can leave a response, or trackback from your own site.

Sorry, no posts matched your criteria.