Sends a triggered email to a contact, unless that contact is marked as unsubscribed..
The emailContact()
function returns a Promise
that resolves when the triggered email is sent to the contact.
Note:
This function replaces the deprecated
wix-crm-backend.emailContact()
.
The deprecated function will continue to work, but it will not receive updates.
To keep any existing code compatible with future changes, see the
migration instructions.
To learn more about triggered emails, see:
Before using the emailContact()
function, you must set up at least 1
triggered email.
Specify which email to send by passing the email's ID in the emailId
parameter.
Specify which contact the email is sent to by passing a contact's ID in the contactId
parameter. To receive the email, the contact must be subscribed or marked as 'subscription not set'.
If the contact is marked as unsubscribed, the email will not be sent.
Read more about how to check the contact's subscription status.
If the specified triggered email contains variables,
you can pass values for those variables using the optional options
parameter.
You pass a variables
object
which contains the values to be inserted into your email in place of the variables
defined in that email. The values passed must be strings. If variables
does not contain a key:value
pair for a
variable in your triggered email, the fallback value defined when creating
your triggered email is inserted in place of the variable.
Notes:
memberId
property and for each
variable key. To learn how to use the generated snippet in your code, see
How to Send a Triggered Email with Code.
Email ID of the triggered email to send.
ID of the contact to send the email to.
Variable values to insert into the email.