Send a transactional email, check on the status of a send, or cancel a future send before it goes out.
https://api.sailthru.com/send
| Parameter | Description | Example |
|---|---|---|
send_id | The unique identifier of the send | TE8EZ3-LmosnAgAA |
getSend(send_id)
| Field | Description | Example |
|---|---|---|
send_id | The unique identifier of the send | TE8EZ3-LmosnAgAA |
email | The destination email address | example@example.com |
template | The name of the template used in the send | test-template |
status | The delivery status of the send – either unknown, scheduled, softbounce, hardbounce, or delivered | delivered |
send_time | The time the message was sent. Present only if the message was sent. | Tue, 27 Jul 2010 12:12:21 -0400 |
schedule_time | The time the message was scheduled. Present only if the message was scheduled in advance. | Tue, 27 Jul 2010 12:10:00 -0400 |
open_time | The time the message was opened with images turned on. Present only if it was actually opened. | Tue, 27 Jul 2010 13:15:59 -0400 |
click_time | The time the message was clicked. Present only if it was actually clicked. | Tue, 27 Jul 2010 13:16:17 -0400 |
Send a transactional email, or schedule one for the near future.
| Parameter | Description | Example |
|---|---|---|
template | the name of the template to send | my-template |
email | the email address to send to | example@example.com |
| Parameter | Description | Example |
|---|---|---|
vars | a key/value hash of the replacement vars to use in the send. Each var may be referenced as {varname} within the template itself | {"varname":"value","name":"Joe Smith"} |
schedule_time | do not send the email immediately, but at some point in the future. Any date recognized by PHP's strtotime function is valid, but be sure to specify timezone or use a UTC time to avoid confusion | 2010-10-10 14:00 UTC |
options[replyto] | customize the Reply-To header | support@example.com |
options[test] | set to 1 to denote the email as a test | 1 |
options[behalf_email] | Use the Sender/From headers to send the email on behalf of a third party | user@example.com |
send(template, email[, vars, options, schedule_time])
Will be identical to the return value of GET mode. This includes the send_id which you can use to reference the message later.
Because the email has just sent, the status of a send will always be unknown at the moment it has sent. This is expected behavior. If you do a GET call a little later, you can retrieve the delivery status.
You are allowed to send the same template to multiple email addresses at once (up to 100 per API call). If you are doing this on a large scale, you may want to consider sending it as a mass mail blast instead.
To multi-send, simply comma-separate the email addresses you wish to multiple-send to. You may also use the following optional parameters:
| Parameter | Description | Example |
|---|---|---|
evars | Key-value hash where each key is an email address, and each value is a key/value hash of variables for that particular email address | evars[example@example.com][myvar]=value |
The return value will be slightly different for a multi-send and will return:
| Field | Description | Example |
|---|---|---|
template | The name of the template | my-template |
sent_count | The number of messages that were sent | |
send_ids | An array of the unique identifiers for each message | ["TE8EZ3-LmosnAgAA","TE8EZ3-LmosnAgAB"] |
Combining schedule_time with multiple send is not currently supported.
Cancels an email that you had previously scheduled for future sending with the schedule_time parameter. It is not possible to cancel an email that has not been scheduled.
| Parameter | Description | Example |
|---|---|---|
send_id | The unique identifier of the send | TE8EZ3-LmosnAgAA |
cancelSend(send_id)
| Field | Description | Example |
|---|---|---|
send_id | The unique identifier of the send | TE8EZ3-LmosnAgAA |
ok | true or 1 | 1 |
GET: Get the status of an in-progress or pending transactional email.
$sailthru_client->getSend('TE8EZ3-LmosnAgAA');
POST: Send a transactional email to a user, tomorrow morning, supplying the user's name and gender to customize the email content.
$sailthru_client->send('my-nextmorning-template','example@example.com', array('name' => 'Joe Schmoe', 'gender' => 'M'), 'tomorrow 09:30 UTC');
DELETE: Delete an in-progress or pending transactional email.
$sailthru_client->cancelSend('TE8EZ3-LmosnAgAA');