<?php require_once "../../csrest_transactional_classicemail.php"; $auth = array("api_key" => "Your API Key"); $wrap = new CS_REST_Transactional_ClassicEmail($auth, NULL); echo "\nSending a simple message...\n"; $simple_message = array("From" => "*****@*****.**", "Subject" => "Test from createsend-php", "To" => "Joe Bloggs <*****@*****.**>", "HTML" => "This is the HTML message body with a <a href='http://google.com'>link</a>."); $group_name = 'PHP test group'; # optional but great for reporting, should not be unique per message $result = $wrap->send($simple_message, $group_name); echo "\nSent! Here's the response:\n"; var_dump($result->response); echo "\nSending a message with all the options...\n"; $complex_message = array("From" => "*****@*****.**", "ReplyTo" => "*****@*****.**", "Subject" => "Test from createsend-php", "To" => array("Sam Jones <*****@*****.**>", "*****@*****.**"), "CC" => array("Mike <*****@*****.**>", "Sally Perlis <*****@*****.**>"), "BCC" => array("*****@*****.**", "*****@*****.**"), "HTML" => "This is the HTML message body with a <a href='http://google.com'>link</a>.", "Text" => "Instead of using the auto-generated text from the HTML, you can supply your own.", "Attachments" => array(array("Name" => "filename.gif", "Type" => "image/gif", "Content" => "R0lGODlhIAAgAKIAAP8AAJmZADNmAMzMAP//AAAAAP///wAAACH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMwMTQgNzkuMTU2Nzk3LCAyMDE0LzA4LzIwLTA5OjUzOjAyICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhc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cIbXDFXqhNacoQ3vZpuxHSJZ2zufyTqcunugdd00vQ0F4chQCAgYCaTcxiYuMMhGJFG89kYpFl5MzkoRPnpJskFSaDqctRoBxHEQsdGs0f7Qjq3utDwkAOw=="))); $group_name = "PHP test group"; # optional, great for reporting, should not be unique message $add_recipients_to_subscriber_list_ID = "6d0366fcee146ab9bdaf3247446bbfdd"; # optional, make sure you have permission $options = array("TrackOpens" => true, "TrackClicks" => true, "InlineCSS" => true); # all are true by default, but you can override $result = $wrap->send($complex_message, $group_name, $add_recipients_to_subscriber_list_ID, $options); echo "\nSent! Here's the response:\n"; var_dump($result->response);
<?php require_once "../../csrest_transactional_classicemail.php"; $auth = array("api_key" => "Your API Key"); $wrap = new CS_REST_Transactional_ClassicEmail($auth); echo "Get the list of classic groups...\n"; $result = $wrap->groups(); var_dump($result->response);