Skip to content
✉️ Generate RFC1521 valid mime files for use with Mailgun and other similar services.
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
lib
templates
test
.eslintignore
.eslintrc
.gitignore
.npmignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
index.js
package.json

README.md

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.

You can’t perform that action at this time.