chassis-email
v0.1.0
Published
Nodemailer wrapper for the Chassis bootstrapper
Downloads
2
Readme
Chassis Email
Nodemailer wrapper for the Chassis bootstrapper.
Getting Started
To install the plugin run:
npm install chassis-email
To enable the plugin, include the module in your code:
const Email = require("chassis-email");
Usage
Example:
let emailBody = {
text: "This is email text.",
html: "<p>This is email text with <b>HTML</b></p>"
}
let options = {
cc: "[email protected]",
replyTo: "[email protected]"
}
var myEmail = new Email("[email protected]", "[email protected]", emailBody, "myTransporter", options);
myEmail.send(function(myEmail) {
if (myEmail.err) {
//handle error
} else {
//email success
}
});
Syntax
new Email(to, from, body, transporter, options);
Parameters
to
(string) – Email address to send to.from
(string) – Email address sent from.body
(string|object) – Email body contents as a string or object.body.text
(string) – Plain text body of email. Optionalbody.html
(string) – HTML body of email. Optionaltransporter
(string) – Email transporter.options
(object) – Object of optional parameters. Optional
Options
cc
(string|array) – Comma separated list or an array of recipients email addresses that will appear on the Cc: field. Optionalbcc
(string|array) – Comma separated list or an array of recipients email addresses that will appear on the Bcc: field. Optionalattachments
(array) – An array of attachment objects. Optionalsender
(string) – An email address that will appear on the Sender: field (always prefer from if you’re not sure which one to use).replyTo
(string) – An email address that will appear on the Reply-To: field. OptionalinReplyTo
(string) – The Message-ID this message is replying to. Optionalreferences
(string|array) – Message-ID list. Optionalenvelope
(object) – SMTP envelope. OptionalattachDataUrls
(boolean) – If true then convert data: images in the HTML content of this message to embedded attachments. OptionalwatchHtml
(object) – Apple Watch specific HTML version of the message. Latest watches have no problems rendering text/html content so watchHtml is most probably never seen by the recipient. Optionalamp
(object) – AMP4EMAIL specific HTML version of the message, same usage as with text and html. OptionalicalEvent
(object) – iCalendar event to use as an alternative. Optionalalternatives
(object) – An array of alternative text contents (in addition to text and html parts). Optionalencoding
(object) – Identifies encoding for text/html strings (defaults to ‘utf-8’, other values are ‘hex’ and ‘base64’). Optionalraw
(object) – Existing MIME message to use instead of generating a new one. OptionaltextEncoding
(object) – Force content-transfer-encoding for text values (either quoted-printable or base64). By default the best option is detected (for lots of ascii use quoted-printable, otherwise base64). Optionalpriority
(object) – Sets message importance headers, either ‘high’, ‘normal’ (default) or ‘low’. Optionalheaders
(object) – An object or array of additional header fields (e.g. {“X-Key-Name”: “key value”} or [{key: “X-Key-Name”, value: “val1”}, {key: “X-Key-Name”, value: “val2”}]). OptionalmessageId
(object) – Message-Id value, random value will be generated if not set. Optionaldate
(object) – Date value, current UTC string will be used if not set. Optionallist
(object) – Helper for setting List-* headers. Optional
Methods
- 'send(callback)' – Sends email instance. Callback returns the email instance with the following additional parameters:
- err (object) – Date value, current UTC string will be used if not set. Optional
- info (object) – Date value, current UTC string will be used if not set. Optional
- response (object) – Date value, current UTC string will be used if not set. Optional