The email service allows sending of email optionally with attachments. It extends the functionality of the template service allowing the email body to be constructed via a template from JSON data. A request to send an email looks like this:
POST /<base path>/<recipients>/...<template path>
- base path is the service base path
- recipients is a comma-separated list of recipients' emails
- template path is the path to the template which will be used to create the email body.
The POST body contains JSON data which is the data source for the template.
The special property
attachmentMsgSpecs on the POSTed JSON is used to add attachments to the email. This is an array of strings which are request specs. The email service attaches the returned bodies from the responses from these requests. The request specs are interpreted using the url of the original email request, and the POST body data of the original email request.
Special configuration properties
Email has all the standard configuration properties plus:
- host: connect to this email host. Email providers will list this and the fields below as configuration values to be entered into an email client.
- port: the port on the email host to use.
- secure: check to use a TLS connection.
- user: user id (usually the email address) of the user on this service.
- password: the password for this user.
- defaultFrom: the default 'from' email address to use.