import {sendMail, initialMailer} from 'mandrill-shion';
// Initialize your Mandrill Api with your api key
initialMailer('YOUR_API_KEY');
export default class SendExample {
async sendMailExample (req, res) {
try {
const variables = [
{
items : ['hola', 'hello'],
date : 'today',
email : 'example@example.com',
firstName : 'Juan',
},
...
];
const mail = await sendMail({
template : 'YOUR_TEMPLATE_NAME',
subject : 'YOUR_SUBJECT',
important : true,
lang : 'handlebars',
variables : variables,
fromEmail : 'hello@example.com',
fromName : 'SUP YOOO!'
});
...
This project uses node and npm. Go check them out if you don't have them locally installed.
$ npm install mandrill-shion --save
Type : string
Initialize the Mandrill API with your API KEY.
Type : object
Sends the email, returns a promise.
Type : string
Name of template on Mandrill, you can found this on 'Template Slug', inside 'Templates' tab.
Type : string
Subject to appear on email.
Type : boolean
If it's important or not, accepts true/false.
Type : string
Language of template, handlebars/mandrill.
Type : array
All variables, it must contain email
and firstName
this is used to know where to sent the email.
Type : string
Email to appear as sender.
Type : string
Name to appear as sender.
MIT ©