Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/romeovs/md-mailer

send markdown emails from the command line.
https://github.com/romeovs/md-mailer

Last synced: 24 days ago
JSON representation

send markdown emails from the command line.

Awesome Lists containing this project

README

        

# md-mailer

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

## Installation

npm install -g md-mailer

## Usage

`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)

greets,
John

![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 -h -p --ssl file.md

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

#### `-h`, `--host`, `$MDMAILER_HOST`, `option.host`
The hostname of the mail server to use. (Example: `smtp.gmail.com`).

#### `-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.

### `from`
The sender of the message. Can be of the form `Name ` or
`email@host`.

### `to`
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:

to:
- Sue Orangeskin
- [email protected]

is equivalent to

to: Sue Orangesking , [email protected]

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

### `subject`
The subject of the message.

## Node API
You can also use the api from node:

import mdmailer from 'md-mailer'
mdmailer({
user: 'example'
, pass: '12345'
, host: 'smtp.gmail.com'
, ssl: true
, files: ['email1.md', 'email2.md' ]
});