add()

Send an email to the website’s owner.

Syntax

add(email Object)

Add an email to the outbox.

Parameters

email Object

Email data.

Object keys:

  • subject string. Email subject.
  • textBody string?. Optional. Text alternative of the email body.
  • htmlBody string?. Optional. Html alternative of the email body.

Description

Add an email to the outbox for sending to the website’s owner. The outbox is attached to the transaction and will be dropped if the transaction fails. If the transaction succeeds and it was the child of another transaction, its outbox is appended to the parent transaction; if it was the root transaction, emails in its outbox are sent after the resposne to the visitor was served.

Each transaction up along the call chain has the power to prevent sending the email. This greatly simplifies testing.

Examples

Add a text email to the outbox.

Add a html email to the outbox.

Add an email to the outbox with both a html and a text alternative.