nodemailer-markdown
Markdown content for Nodemailer
Last updated a year ago by andris .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install nodemailer-markdown 
SYNC missed versions from official npm registry.

Markdown plugin for Nodemailer

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

Install from npm

npm install nodemailer-markdown --save

Usage

1. Load the markdown function

var markdown = require('nodemailer-markdown').markdown;

2. Attach it as a 'compile' handler for a nodemailer transport object

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

3. Set a markdown value

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'}
};

Example

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'
});

License

MIT

Current Tags

  • 1.0.3                                ...           latest (a year ago)

7 Versions

  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           6 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 0
Last Month 15
Dependencies (1)
Dev Dependencies (6)

Copyright 2014 - 2017 © taobao.org |