0.1.0 • Published 3 years ago

chassis-email v0.1.0

Weekly downloads
5
License
ISC
Repository
github
Last release
3 years ago

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: "someone.else@somemail.com",
    replyTo: "another.email@mail.com"
}

var myEmail = new Email("me@myemail.com", "you@youremail.com", 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. Optional
  • body.html (string) – HTML body of email. Optional
  • transporter (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. Optional
  • bcc (string|array) – Comma separated list or an array of recipients email addresses that will appear on the Bcc: field. Optional
  • attachments (array) – An array of attachment objects. Optional
  • sender (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. Optional
  • inReplyTo (string) – The Message-ID this message is replying to. Optional
  • references (string|array) – Message-ID list. Optional
  • envelope (object) – SMTP envelope. Optional
  • attachDataUrls (boolean) – If true then convert data: images in the HTML content of this message to embedded attachments. Optional
  • watchHtml (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. Optional
  • amp (object) – AMP4EMAIL specific HTML version of the message, same usage as with text and html. Optional
  • icalEvent (object) – iCalendar event to use as an alternative. Optional
  • alternatives (object) – An array of alternative text contents (in addition to text and html parts). Optional
  • encoding (object) – Identifies encoding for text/html strings (defaults to ‘utf-8’, other values are ‘hex’ and ‘base64’). Optional
  • raw (object) – Existing MIME message to use instead of generating a new one. Optional
  • textEncoding (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). Optional
  • priority (object) – Sets message importance headers, either ‘high’, ‘normal’ (default) or ‘low’. Optional
  • headers (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”}). Optional
  • messageId (object) – Message-Id value, random value will be generated if not set. Optional
  • date (object) – Date value, current UTC string will be used if not set. Optional
  • list (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
0.1.0

3 years ago

0.0.1

4 years ago