Configuration

Path: /src/configSchema.coffee compiled to /lib/configSchema.js

The configuration consists of two parts:

  • Email Template
  • Collection of Templates

Email Template

Email Action is the setup for an individual email action.

An object with the following keys allowed: base, transport, retry, from, replyTo, to, cc, bcc, locale, subject, body, attachments. The following entries have a specific format:

base

Base Template is the template used as basis for this one.

A text entry in which all control characters will be removed.

transport

Service Connection is the service connection to send mails through.

It has to be one of the following types:

  • Transport URI is the transport method as URI string through which the mail will be send like <protocol>://<user>:<password>@<server>:<port>.

    A text entry in which all control characters will be removed.

  • Transport Object is the mail transport settings through which the mail will be send.

    An object.

retry

Retry is the number of retries to take if sending failed.

An object which is optional and will be set to { times: 1, interval: 5000 } if not specified. The following keys have to be present: times, interval. The following entries have a specific format:

times

Number of Attempts are the number of maximal attempts to run successfully.

An integer value which is optional and will be set to 1 if not specified. The value should be greater than 0.

interval

Time to Wait is the time to wait before retrying a failed attempt.

A time interval as float, in time format or as text which may use a combination of values with the units: ms, s, m, h, d which is optional and will be set to 5000 if not specified. The result will be given as the number of ms. A numeric floating point number. The value should be greater than 0.

from

From is the address emails are send from.

A text entry in which all control characters will be removed.

replyTo

Reply To is the address to send answers to.

A text entry which is optional. All control characters will be removed.

to

To is the address emails are send to.

A list. Each entry has to be of type:

A text entry in which all control characters will be removed.

cc

Cc is the carbon copy addresses.

A list. Each entry has to be of type:

A text entry in which all control characters will be removed.

bcc

Bcc is the blind carbon copy addresses.

A list. Each entry has to be of type:

A text entry in which all control characters will be removed.

locale

Locale Setting is the locale setting for subject and body dates.

A text entry in which all control characters will be removed. The text will get lower case. It has to be between 2 and 5 characters long. The text should match: /[1](-[a-z]{2})?$/.

subject

Subject is the subject line of the generated email.

A valid text which may contain handlebar syntax and variables.

body

Content is the body content of the generated email.

A valid text which may contain handlebar syntax and variables.

attachments

Attachments are the attachments to be included.

A list. Each entry has to be of type:

Attachment is the attachment to be included.

An object with the following keys allowed: filename, content, path, contentType, contentDisposition, cid, encoding. The following entries have a specific format:

filename

Reported Filename is the filename to be reported as the name of the attached file (set this value as false to disable, default: created automatically).

A text entry in which all control characters will be removed.

content

Content is the content of the attached file.

A text entry in which all control characters will be removed.

path

Include File is the path to a file or an URL if you want to stream the file instead of including it.

A text entry in which all control characters will be removed.

contentType

Content Type is the optional content type for the attachment (autodetected).

A text entry in which all control characters will be removed.

contentDisposition

Disposition is the optional content disposition type for the attachment (default: attachment).

A text entry in which all control characters will be removed.

cid

Content ID is the optional content id for using inline images in HTML message source.

A text entry in which all control characters will be removed.

encoding

Encoding is the content encoding like: base64, hex, binary etc…

A text entry in which all control characters will be removed.

Collection of Templates

Email Templates are the possible templates used for sending emails.

An object. The entries are:

  • any key: Email Action is the setup for an individual email action.

    An object with the following keys allowed: base, transport, retry, from, replyTo, to, cc, bcc, locale, subject, body, attachments. The following entries have a specific format:

    base

    Base Template is the template used as basis for this one.

    A text entry in which all control characters will be removed.

    transport

    Service Connection is the service connection to send mails through.

    It has to be one of the following types:

    • Transport URI is the transport method as URI string through which the mail will be send like <protocol>://<user>:<password>@<server>:<port>.

      A text entry in which all control characters will be removed.

    • Transport Object is the mail transport settings through which the mail will be send.

      An object.

    retry

    Retry is the number of retries to take if sending failed.

    An object which is optional and will be set to { times: 1, interval: 5000 } if not specified. The following keys have to be present: times, interval. The following entries have a specific format:

    times

    Number of Attempts are the number of maximal attempts to run successfully.

    An integer value which is optional and will be set to 1 if not specified. The value should be greater than 0.

    interval

    Time to Wait is the time to wait before retrying a failed attempt.

    A time interval as float, in time format or as text which may use a combination of values with the units: ms, s, m, h, d which is optional and will be set to 5000 if not specified. The result will be given as the number of ms. A numeric floating point number. The value should be greater than 0.

    from

    From is the address emails are send from.

    A text entry in which all control characters will be removed.

    replyTo

    Reply To is the address to send answers to.

    A text entry which is optional. All control characters will be removed.

    to

    To is the address emails are send to.

    A list. Each entry has to be of type:

    A text entry in which all control characters will be removed.

    cc

    Cc is the carbon copy addresses.

    A list. Each entry has to be of type:

    A text entry in which all control characters will be removed.

    bcc

    Bcc is the blind carbon copy addresses.

    A list. Each entry has to be of type:

    A text entry in which all control characters will be removed.

    locale

    Locale Setting is the locale setting for subject and body dates.

    A text entry in which all control characters will be removed. The text will get lower case. It has to be between 2 and 5 characters long. The text should match: /[2](-[a-z]{2})?$/.

    subject

    Subject is the subject line of the generated email.

    A valid text which may contain handlebar syntax and variables.

    body

    Content is the body content of the generated email.

    A valid text which may contain handlebar syntax and variables.

    attachments

    Attachments are the attachments to be included.

    A list. Each entry has to be of type:

    Attachment is the attachment to be included.

    An object with the following keys allowed: filename, content, path, contentType, contentDisposition, cid, encoding. The following entries have a specific format:

    filename

    Reported Filename is the filename to be reported as the name of the attached file (set this value as false to disable, default: created automatically).

    A text entry in which all control characters will be removed.

    content

    Content is the content of the attached file.

    A text entry in which all control characters will be removed.

    path

    Include File is the path to a file or an URL if you want to stream the file instead of including it.

    A text entry in which all control characters will be removed.

    contentType

    Content Type is the optional content type for the attachment (autodetected).

    A text entry in which all control characters will be removed.

    contentDisposition

    Disposition is the optional content disposition type for the attachment (default: attachment).

    A text entry in which all control characters will be removed.

    cid

    Content ID is the optional content id for using inline images in HTML message source.

    A text entry in which all control characters will be removed.

    encoding

    Encoding is the content encoding like: base64, hex, binary etc…

    A text entry in which all control characters will be removed.

Addressing

First you can define the sender address using:

YAML Data
from: <string> # the address used as sender(often the same as used in transport) replyTo: <string> # address which should be used for replys

And you give the addresses to send the mail to. In the following fields: to, cc and bcc you may give a single address or a list of addresses to use. All e-mail addresses can be plain e-mail addresses

name@mymailserver.com

or with formatted name (includes unicode support)

"My Name" <name@mymailserver.com>

Content

The content of the mail consists of an subject line which should be not to long and the body. The body is given as Markdown syntax and supports all possibilities from report. This will be converted to a plain text and html version for sending so that the mail client can choose the format to display.

You may also give the ‘text’ and ‘html’ content as property itself. But keep in mind that within the base properties no markdown conversions are done. In the ’body’ it will.

Like you see above, you can use handlebar syntax to use some variables from the code. This is possible in subject and body. And you may specify a locale to use for date formatting.

You can also define different templates which can be referenced from within the job.

Find more examples at validator.

Attachments

The key attachments is used to add a list of files attached to the email and consists of the following properties:

  • path path to a file or an URL to include
  • filename filename to be reported as the name of the attached file
  • content String, Buffer or a Stream contents for the attachment
  • contentType optional content type for the attachment, if not set will be derived from the filename property
  • contentDisposition optional content disposition type for the attachment, defaults to ‘attachment’
  • cid optional content id for using inline images in HTML message source
  • encoding If set and content is string, then encodes the content to a Buffer using the specified encoding. Example values: base64, hex, binary etc.
  • headers custom headers for the attachment node

  1. a-z ↩︎

  2. a-z ↩︎