1.0.0-alpha.0 • Published 8 years ago
cliche-mailer v1.0.0-alpha.0
Nodemailer wrapper for cliche with automatic templates rendering.
Installation
npm install --save cliche-mailer
Usage
Under the hoods email-templates
package is being used to render templates and inline css directly into the resulting html.
Templates must be located in directory specified by templatesDir
option of constructor (email_templates
by default). Please refer to email-templates
documentation for templates directory structure details.
With default nodemailer-pickup-transport
(message will be rendered and put into outbox
directory in process.cwd()
):
const Mailer = require('cliche-mailer');
const mailer = new Mailer();
mailer.send('newsletter', {
from: 'sender@example.com',
to: 'recipient@example.com',
subject: 'Newsletter',
});
With custom transport:
const Mailer = require('cliche-mailer');
const mailer = new Mailer({
transport: 'nodemailer-mailgun-transport',
transportOptions: {
auth: {
api_key: 'YOUR MAILGUN API_KEY HERE',
domain: 'YOUR MAILGUN DOMAIN HERE',
},
},
});
mailer.send('newsletter', {
from: 'sender@example.com',
to: 'recipient@example.com',
subject: 'Newsletter',
});
Tests
npm test
License
1.0.0-alpha.0
8 years ago