AMPscript
Add
Pause
Publish
Retrieve
Send
Start
Update
Validate Your Server-Side JavaScript using WSProxy
Sends an email message using an existing triggered send definition.
Send(emailAddress, sendTimeAttributes)
The Send() function has the properties in this table.
| Ordinal | Type | Description |
|---|---|---|
emailAddress | String | Required. Email address used for triggered send. This function does not support the use of subscriber key. |
sendTimeAttributes | Object | An object that contains the attributes to include in the send. |
This sample code initializes the triggeredSend object and sends the email to the specified email address.
1var triggeredSend = TriggeredSend.Init("triggeredSend");
2var status = triggeredSend.Send("aruiz@example.com");This sample code initializes the triggeredSend object and sends the email to the specified email address. The Send() request includes the subscriber’s first name and a coupon code as send time attributes.
1var triggeredSend = TriggeredSend.Init("triggeredSend");
2var status = triggeredSend.Send("aruiz@example.com", {
3 FirstName: "Angel",
4 CouponCode: "AA1AF",
5});The send returns a status of either OK or Error. You can review the LastMessage for more detailed error information. For example, This sample code demonstrates this using the triggeredSend from the previous example.
1var status = triggeredSend.Send("aruiz@example.com");
2if (status != "OK") {
3 var message = TriggeredSend.LastMessage;
4}