Send markdown emails from your command line.
Last updated 4 years ago by romeovs .
ISC · Original npm · Tarball · package.json
$ cnpm install md-mailer 
SYNC missed versions from official npm registry.


A simple tool to send markdown emails from the command line.


npm install -g md-mailer


md-mailer allows one to write emails in markdown, it supports embedded images and attachments.

To use it, first prepare your email:

from: John Appleseed <>
to:   Jack Bananapeel <>, Sue Orangeskin <>
cc:   John Appleseed <>
subject: An example email!

This is an example email! **Bold** text etc, it all works!

![an inline image](./image.jpg)


![an attached pdf](./document.pdf)

Just embed all the sending information in the frontmatter preamble of the email file.

To send the email, invoke md-mailer:

md-mailer -u <user> -h <host> -p <pass> --ssl

Markdown interpolation

Sometimes, you need to be able to insert variable text into your email. To allow this, md-mailer extends markdown with a little of custom syntax:

Hi my name is ${NAME},


will replace the ${NAME} and $NAME variables with their value (found in the environment). This also works for the frontmatter of your email:

from: $ME
subject: ${SUBJECT}


These can be passed as command line arguments, or as environment variables.

-h, --host, $MDMAILER_HOST,

The hostname of the mail server to use. (Example:

-P, --port, $MDMAILER_PORT, options.port

The port of the mail server.

-u, --user, $MDMAILER_USER, options.user

The username of the account that should be used at the mail provider.

-p, --pass, $MDMAILER_PASS, options.pass

The password of the account that should be used at the mail provider.

Note: using the command line arguments like this might be unsafe, because the password will be stored cleatext in your shell history. Prefer setting the environment variable $MDMAILER_PASS.

--ssl, options.ssl

If present, md-mailer uses SSL.

-d, --dry-run

If present, md-mailer will not actually send any emails.

-?. --help

Show the help text.

Header options

These options can be set from the email message header.


The sender of the message. Can be of the form Name <email@host> or email@host.


A list of recipients to which the message will be sent. You can enter a comma-separated list of emails (in the formats described in from) or use yamls list syntax:

- Sue Orangeskin <> 

is equivalent to

to: Sue Orangesking <>,

cc, bcc

The list of carbon copy and blind carbon copy recipients, the format used in to is also valid here.


The subject of the message.

Node API

You can also use the api from node:

import mdmailer from 'md-mailer'
  user: 'example'
, pass: '12345'
, host: ''
, ssl: true
, files: ['', '' ]

Current Tags

  • 0.0.8                                ...           latest (4 years ago)

7 Versions

  • 0.0.8                                ...           4 years ago
  • 0.0.7                                ...           4 years ago
  • 0.0.6                                ...           4 years ago
  • 0.0.4                                ...           4 years ago
  • 0.0.3                                ...           4 years ago
  • 0.0.2                                ...           4 years ago
  • 0.0.1                                ...           4 years ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (7)
Dev Dependencies (1)
Dependents (0)

Copyright 2014 - 2016 © |