Email.send()

Send an email, either in plaintext or from an HTML template.

This method is implemented using the `nodemailer` package, and sends emails via SMTP. See `tests/test.js` for example usage.

Usage

Hover over inputs/exits for more info.

var Email = require('machinepack-email');


// Send an email, either in plaintext or from an HTML template.

Email.send({

auth: {},

service: 'gmail',

mail: {},

customTransport: 'nodemailer-stub-transport',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function () {

 

},

});

Inputs

auth required

Authentication metadata for the provided service.

{}
service required

The name of a service to use for SMTP delivery.

'gmail'
mail required

A dictionary describing your email message and associated metadata (from, to, ...).

{}
customTransport

A nodemailer "service module" to use for sending the email.

'nodemailer-stub-transport'

Exits

error

An unexpected error occurred.

success

OK.