Send email using Email Template CRM 2011, 2013 and 2015

Here is the code for sending an email via template using C# code

SendEmailFromTemplateRequest emailUsingTemplateReq = new SendEmailFromTemplateRequest
      Target = entEmail,
      // Template ID
      TemplateId = entEmailTemplate.Id,
      // The regarding Id is required, and must be of the same type as the Email Template.
      RegardingId = erfRecord.Id,
      RegardingType = Constants.OPPORTUNITY

// SendEmailFromTemplateRequest creates one more email for sending. So deleting the email created initially.
service.Delete(Constants.EMAIL, entEmail.Id);

Happy CRM’ing

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s