Sends an email message using an existing triggered send definition.
Syntax
Send(emailAddress, sendTimeAttributes)
Function Properties
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. |
Example
This sample code initializes the triggeredSend object and sends the email to the specified email address.
var triggeredSend = TriggeredSend.Init("triggeredSend");
var 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.
var triggeredSend = TriggeredSend.Init("triggeredSend");
var status = triggeredSend.Send("aruiz@example.com", {
FirstName: "Angel",
CouponCode: "AA1AF",
});
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.
var status = triggeredSend.Send("aruiz@example.com");
if (status != "OK") {
var message = TriggeredSend.LastMessage;
}