Sending an Email (bizzStream.sendMail)
You can use bizzStream.sendMail to programmatically send emails from within your scripts.
Syntax
bizzStream.sendMail(options);
Parameters
The sendMail function takes a single 'options' object with the following properties:
| Parameter | Type | Required | Description |
|---|---|---|---|
| documentId | String | Yes | The id of a document. Used to get all needed data for the content. |
| subject | String | Yes | The subject line of the email. |
| content | String | Yes | The name of an email template. The content of this template will be used as the email body. |
| from | String | No | The sender's email address. If not provided, the default will be used (no-reply@bizzstream.com). |
| attachmentTemplateNames | Array of Strings | No | A list of template names to include as email attachments. |
| attachmentFieldNames | Array of Strings | No | A list of attachment field names whose files are included as email attachments. |
| otherRecipients | String | No | A string of 'To' recipients, containing one or more email addresses (e.g., comma-separated). |
| recipientAccessGroupNames | Array of Strings | Yes (if otherRecipients is not provided) | A list of names of access groups whose members should receive the email. This parameter is required if 'otherRecipients' is not specified. |
| ccRecipients | String | No | A string of 'CC' recipients, containing one or more email addresses (e.g., comma-separated). |
| ccRecipientsAccessGroupNames | Array of Strings | No | A list of names of access groups whose members should be CC'd on the email. |
| bccRecipients | String | No | A string of 'BCC' recipients, containing one or more email addresses (e.g., comma-separated). |
| bccRecipientsAccessGroupNames | Array of Strings | No | A list of names of access groups whose members should be BCC'd on the email. |
Return value
None.
Example
The following example shows how to send a simple email:
bizzStream.sendMail({
documentId: SavedDocument._id,
subject: 'Script Notification',
content: '12345FakeTemplate',
otherRecipients: 'recipient@example.com',
ccRecipients: 'cc-recipient@example.com',
bccRecipients: 'bcc-recipient@example.com',
attachmentTemplateNames: ['12345FakeTemplate'],
attachmentFieldNames: ['invoiceFile']
});