This applies to Nodemailer v1.0+. This plugin adds an option markdown
for the Nodemailer e-mail options. This value will be used to populate text
and html
so you don't have to.
Install from npm
npm install nodemailer-markdown --save
var markdown = require('nodemailer-markdown').markdown;
nodemailerTransport.use('compile', markdown(options))
Where
- options - includes options for the marked parser with the following additions:
- useEmbeddedImages - if true, load or download referenced images and include these as attachments
Any nodemailer content value can be used: String, Buffer, Stream or an object in the form of {path: filepath/url}
var mailOptions1 = {
markdown: '# Hello world!\n\nThis is a **markdown** message'
};
var mailOptions2 = {
markdown: {path: __dirname + '/message.md'}
};
var nodemailer = require('nodemailer');
var transporter = nodemailer.createTransport();
transporter.use('compile', markdown());
transporter.sendMail({
from: 'me@example.com',
to: 'receiver@example.com',
markdown: '# Hello world!\n\nThis is a **markdown** message'
});
MIT