nxus-mailer

4.1.0 • Public • Published

nxus-mailer

Table of Contents

Mailer

Extends NxusModule

Build Status

A Nxus module for sending emails through different services.

Installation

> npm install nxus-mailer --save

Usage

Register a mail service

mailer.service(myService)

Each service is expected to implement a method called sendMessage with the signature

sendMessage(to, from, subject, content, opts) {
...
}

Alternatively, you can specify an array of to addresses:

sendMessage([toAddress, toAddress2], from, subject, content, opts) {
...
}

Send an email using a service

mailer.send('to@address', 'from@address', "My subject", "Body content", {some: opts})

Opts

The opts hash can be used to send service specific opts back to the mail handler. For example:

// SendGrid opts
mailer.send('to@address', 'from@address', "My subject", "Body content", {html: "<p>Html content</p>"})

service

Register a service. See SendgridService for an example.

Parameters

  • service function a Class or callable that implements a method called sendMessage.

send

Sends an email. Should be overridden by the sending service, but generally will take the following parameters

Parameters

  • args ...any
  • to String The email address to send to
  • from String The from email to send from
  • subject String The subject text
  • body String The message text
  • options Object An objects containing

Readme

Keywords

Package Sidebar

Install

npm i nxus-mailer

Weekly Downloads

0

Version

4.1.0

License

MIT

Unpacked Size

16.7 kB

Total Files

11

Last publish

Collaborators

  • mjreich
  • loppear
  • davidkellerman
  • scottmaxson