예제 #1
0
<?php

require_once "../../csrest_transactional_smartemail.php";
$auth = array("api_key" => "Your API Key");
$wrap = new CS_REST_Transactional_SmartEmail(NULL, $auth);
echo "\nGetting the list of smart emails...\n";
$result = $wrap->get_list();
echo "Found " . count($result->response) . " smart emails, here's the first in the list:\n";
var_dump($result->response);
echo "\nGetting the list smart emails, filtered by status...\n";
$total = $wrap->get_list(array("status" => 'all'))->response;
$active = $wrap->get_list(array("status" => 'active'))->response;
$draft = $wrap->get_list(array("status" => 'draft'))->response;
echo "Found " . count($active) . " active and " . count($draft) . " draft smart emails, for a total of " . count($total) . " smart emails.\n";
예제 #2
0
<?php

require_once "../../csrest_transactional_smartemail.php";
$auth = array("api_key" => "Your API Key");
$smart_email_id = "Smart Email ID goes here";
#grab it from the URL
$wrap = new CS_REST_Transactional_SmartEmail($smart_email_id, $auth);
echo "\nGetting the details of the smart email...\n";
$result = $wrap->get_details($smart_email_id);
var_dump($result->response);
예제 #3
-2
<?php

require_once '../../csrest_transactional_smartemail.php';
$auth = array("api_key" => "Your API Key");
$smart_email_id = "Smart Email ID goes here";
#grab it from the URL
$wrap = new CS_REST_Transactional_SmartEmail($smart_email_id, $auth);
echo "\nSending a simple smart email...\n";
$simple_message = array("To" => "Jane Bloggs <*****@*****.**>", "Data" => array("username" => "janebloggs"));
$result = $wrap->send($simple_message);
echo "\nSent! Here's the response:\n";
var_dump($result->response);
echo "\nSending a message with all the options...\n";
$complex_message = array("To" => array("Sam Jones <*****@*****.**>", "Phil Oye <*****@*****.**>", "*****@*****.**"), "CC" => array("Mike <*****@*****.**>", "Sally Perlis <*****@*****.**>"), "BCC" => array("*****@*****.**", "*****@*****.**"), "Data" => array("username" => "janebloggs"), "Attachments" => array(array("Name" => 'filename.gif', "Type" => 'image/gif', "Content" => 'R0lGODlhIAAgAKIAAP8AAJmZADNmAMzMAP//AAAAAP///wAAACH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhp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U09LR0M/OzczLysnIx8bFxMPCwcC/vr28u7q5uLe2tbSzsrGwr66trKuqqainpqWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEAAAAAAAsAAAAACAAIAAAA5loutz+MKpSpIWU3r1KCBW3eYQmWgWhmiemEgPbNqk6xDOd1XGYV77UzTfbTWC4nAHYQRKLu1VSuXxlpsodAFDAZrfcIbXDFXqhNacoQ3vZpuxHSJZ2zufyTqcunugdd00vQ0F4chQCAgYCaTcxiYuMMhGJFG89kYpFl5MzkoRPnpJskFSaDqctRoBxHEQsdGs0f7Qjq3utDwkAOw==')));
$add_recipients_to_subscriber_list = true;
$result = $wrap->send($complex_message, $add_recipients_to_subscriber_list);
echo "\nSent! Here's the response:\n";
var_dump($result->response);