November Perfect Moustache
Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

mailmake

1.0.8 • Public • Published

mailmake

Generate RFC1521 valid mime files for use with Mailgun and other similar services.

Build Status codecov Dependency Status Known Vulnerabilities bitHound Overall Score NPM Version Greenkeeper badge Latest Documentation

Installation

$ npm install mailmake -g

Usage

 Usage: mailmake <path> [options]

 Options:

  -h, --help        Display this help message.
  -v, --version     Display the current installed version.
  -f, --from        Set the from email address header.
  -s, --subject     Set the subject header.
  -t, --to          Set the to email address header.

CLI

$ mailmake email.html --from "test@example.com" --subject "Hello World!" --to "mailing-list@example.com" > email.mime

API

Install

$ npm install mailmake --save

Usage

const mailmake = require('mailmake');
 
const email_contents = '# Hello World!';
 
mailmake.generate(email_contents, {
    'from': 'test@example.com',
    'subject': 'Hello World!',
    'to': 'mailing-list@example.com'
}).then(output => {
    console.log(output);
});

lib/mailmake.js

randomString()

Returns a randomly generated string based on seed.

console.log(mailmake.randomString());
Returns
  • String Randomly generated string.

boundaryString()

Returns a boundary string.

console.log(mailmake.boundaryString());
Returns
  • String Boundary string.

generateFromString(input[, options]) private method

Returns generated mime file contents.

console.log(mailmake.generateFromString('# Hello World!', {
    'from': 'test@example.com',
    'subject': 'Hello World!',
    'to': 'mailing-list@example.com'
}));
Parameters
Name Type Description
input String String of email contents. Can be either HTML or Markdown.  
options String Options for generating file. Optional
options.from String From address of email. Optional
options.subject String Subject of email. Optional
options.to String To address of email. Optional
Returns
  • String Returns contents of generated mime file.

generate(input[, options])

Returns generated mime file contents based on either file or string.

mailmake.generate('email.html', {
   'from': 'test@example.com',
   'subject': 'Hello World!',
   'to': 'mailing-list@example.com'
}).then(output => {
   console.log(output);
});
Parameters
Name Type Description
input String File path or string of email contents. Can be either HTML or Markdown.  
options String Options for generating file. Optional
options.from String From address of email. Optional
options.subject String Subject of email. Optional
options.to String To address of email. Optional
Returns
  • Object Promise returns contents of generated mime file.

Reference

http://www.w3.org/Protocols/rfc1341/0_TableOfContents.html

Documentation generated with doxdox.

install

npm i mailmake

Downloadsweekly downloads

31

version

1.0.8

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability