1.2.0 • Published 4 years ago
send-mjml v1.2.0
Send MJML
1. Import
const { Sender } = require('send-mjml')
import Sender from 'send-mjml'
2. Create a Sender
const sender = new Sender({
service: 'gmail',
email: 'kenmueller0@gmail.com',
password: '•••••'
})
3. Send your email
// Returns a Promise
sender.sendMjml({
from: 'kenmueller0@gmail.com', // If unspecified, it chooses either your `defaultFrom` (specified in the `Sender` options), or your `email`
to: 'notken@gmail.com',
subject: 'This is a test email',
path: [__dirname, 'emails/test.mjml'], // Joins the paths
context: { // Uses https://handlebarsjs.com
name: 'Ken Mueller',
title: 'This is a test email'
}
})