Skip to content

danieljonce/meteor-mandrill

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mandrill for Meteor

Meteor package for sending email via Mandrill

Installation

$ meteor add wylio:mandrill

Example Usage for SMTP email

# in server code
Meteor.startup(function() {
    return Meteor.Mandrill.config({
        username: "YOUR_MANDRILL_USERNAME",
        key: "YOUR_MANDRILL_API_KEY"
    });
});

this.sendEmail = function(to, subject, htmlText) {
    return Meteor.Mandrill.send({
        to: to,
        from: fromEmail,
        subject: subject,
        html: htmlText
    });
};

Example API usage

Read more on how to use merge tags in the Mandrill docs.

The sendTemplate method uses Mandrill's https://mandrillapp.com/api/1.0/messages/send-template.json call.

Find out what else you can send, including how to send mc:edit regions, by reviewing the Mandrill API documentation.

#server code
Meteor.Mandrill.sendTemplate({
    "key": "YOUR_MANDRILL_API_KEY", // optional, if you set it in with Meteor.Mandril.config() already
    "template_name": "YOUR_TEMPLATE_SLUG_NAME",
    "template_content": [
      {}
    ],
    "message": {
        "global_merge_vars": [
            {
                "name": "var1",
                "content": "Global Value 1"
            }
        ],
        "merge_vars": [
            {
                "rcpt": "email@example.com",
                "vars": [
                    {
                        "name": "fname",
                        "content": "John"
                    },
                    {
                        "name": "lname",
                        "content": "Smith"
                    }
                ]
            }
        ],
        "to": [
        {"email": email@example.com}
        ]
    }
});

About

Meteor package for sending email via Mandrill

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%