Publishing Templates Example

Templates are a useful tool to use with Mandrill, they will allow you to send the same email to multiple recipients whilst customising the content.

You can set templates up on Mandrill's website but you can also use Easy Email For Mandrill, this example will show you how to publish templates using the plugin.


Publish Template Form
Template Name

Step By Step

Step 1

First you need to follow the guide for integrating the DLL and setting up Easy Email at Setting Up.

Step 2

Next add the following code to the click event of your create button, or wherever you want to create your template from

//Create the template
EasyEmailForMandrill.MandrillTemplate.TemplateInformation template =

//Show the response
lblOut.Text =
    "Updated Date of published template: " + template.UpdatedDate;
catch (Exception exception)
    //Handle the error
    lblOut.Text = "Error: " + exception.Message;

Step 3

A class will be returned with the information about the template you just published. It will contain the following information.

    "slug": "example-template",
    "name": "Example Template",
    "labels": [
    "code": "<div mc:edit=\"editable\">editable content</div>",
    "subject": "example subject",
    "from_email": "",
    "from_name": "Example Name",
    "text": "Example text",
    "publish_name": "Example Template",
    "publish_code": "<div mc:edit=\"editable\">different than draft content</div>",
    "publish_subject": "example publish_subject",
    "publish_from_email": "",
    "publish_from_name": "Example Published Name",
    "publish_text": "Example published text",
    "published_at": "2013-01-01 15:30:40",
    "created_at": "2013-01-01 15:30:27",
    "updated_at": "2013-01-01 15:30:49"