Sends a triggered email to the current contact, unless that contact is marked as unsubscribed.
To learn more about triggered emails, see:
Before calling emailContact()
you need to set up at least 1
triggered email.
This method only sends an email to the current site visitor. To receive the email, the site visitor must be a contact with a subscriptionStatus
set to "SUBSCRIBED"
OR "NOT_SET"
.
If the site visitor's subscriptionStatus
is set to "UNSUBSCRIBED"
, the email will not be sent.
Read more about how to check a contact's subscriptionStatus
(SDK | Velo).
Currently, to send an email to a subscribed contact who is not the
current site visitor is only available in Velo with the
backend triggeredEmails.emailContact()
method.
If the specified triggered email contains variables,
you can specify values for those variables using the optional options
parameter.
The values specified must be strings. If the object
specified to the variables
object does not contain a key:value
pair for a
variable in the triggered email, the fallback value defined when creating
the triggered email is inserted in place of the variable.
Note that creating a triggered email
generates a code snippet
for each of the triggered email templates. The generated code includes the email's ID and keys for all the
email's variable names. Copy and paste the snippet into your code and define values for the contactId
property
and for each variable key. To learn how to use the generated snippet in code, see
How to Send a Triggered Email with Code.
Note: The frontend CRM APIs aren't fully functional when previewing a site. View a published version of a site to see their complete functionality.
ID of the triggered email to send.
ID of the contact to send the email to.
Variable values to insert into the email.