sendmail

module:sendmail

Description:
  • Send email via various transports

Source:

Members

(static) args :Array.<ConfigOptions>

Source:
Default Value:
  • [
      {
        "name": "from",
        "descr": "Email address to be used when sending emails from the backend"
      },
      {
        "name": "transport",
        "descr": "Send emails via supported transports: ses:, sendgrid:, fake:, file:, json:, if not set default SMTP settings are used"
      },
      {
        "name": "smtp",
        "obj": "smtp",
        "type": "map",
        "merge": 1,
        "descr": "SMTP server parameters, user, password, host, ssl, tls...see nodemailer for details"
      },
      {
        "name": "options-(.+)",
        "obj": "options.$1",
        "type": "map",
        "merge": 1,
        "descr": "Transport specific parameters",
        "example": "sendmail-options-sendgrid = key:xxxx\nsendmail-options-ses = config:cfg1,region:us-west-2"
      }
    ]

Methods

(static) send(options, callbackopt)

Description:
  • Send email via nodemailer with SMTP transport, other supported transports:

Source:
Parameters:
Name Type Attributes Description
options object
Properties
Name Type Attributes Description
transport string <optional>

supported transports:

  • fake: - same as json
  • json: - return message as JSON
  • file: - save to a file in the /tmp/
  • ses: - send via AWS SES service v2
  • sendgrid: using SendGrid API

In returned data object there should be messageId from the transport

subject string <optional>

subject line

from string <optional>

FROM address

to string <optional>

TO address

cc string <optional>

CC address

bcc string <optional>

BCC address

text string <optional>

text body

html string <optional>

HTML body

callback function(err:object, data:object) <optional>

(async, static) send(options) → {Object}

Description:
Source:
Parameters:
Name Type Description
options object
Returns:
Type Description
{err:object, data:object}
Example
const { err, data } = sendmail.send({ to: "email@com", subject: "...", text: "...", html: "..." });