Back to Top

mailmake master

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

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 declaration

Returns generated mime file contents.

console.log(mailmake.generateFromString('# Hello World!', {
    'from': '[email protected]',
    'subject': 'Hello World!',
    'to': '[email protected]'
}));

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': '[email protected]',
   'subject': 'Hello World!',
   'to': '[email protected]'
}).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.