Skip to content

Instantly share code, notes, and snippets.

@davehewy
Created September 28, 2012 14:39
Show Gist options
  • Save davehewy/3800269 to your computer and use it in GitHub Desktop.
Save davehewy/3800269 to your computer and use it in GitHub Desktop.
Mandrill send
require_once('Mandrill.php');
echo 'loaded mandrill...';
# Set mandrill's API Key.
Mandrill::setKey('89037b32-04f2-494a-8475-f85889c3fab4');
$ret = Mandrill::call(array('type'=> 'messages', 'call'=> 'send',
"message" => array(
"html" => "hey dave",
"text" => "hey dave text",
"subject" => "Oi oi from mandrill",
"from_email"=>"bytewire@bytewire.co.uk",
"from_name" => "Bytewire",
"to" => array(
"0" => array(
"email" => "dave@bytewire.co.uk",
"name" => "David Heward"
)
),
"headers" => array(
"track_opens" => "true",
"track_clicks" => "true"
),
"tags" => array(
"test"
)
)));
print_r($ret);
//
// $request_json = '{"type":"messages","call":"send","message":{"html": "<h1>example html</h1>", "text": "example text", "subject": "example subject", "from_email": "wes@werxltd.com", "from_name": "example from_name", "to":[{"email": "wes@reasontostand.org", "name": "Wes Widner"}],"headers":{"...": "..."},"track_opens":true,"track_clicks":true,"auto_text":true,"url_strip_qs":true,"tags":["test","example","sample"],"google_analytics_domains":["werxltd.com"],"google_analytics_campaign":["..."],"metadata":["..."]}}';
//print_r(Mandrill::getApiCalls());
# Set debugging to on
Mandrill::setVerbose(true);
echo '<br><br>Mandrill returned an error: '.Mandrill::getLastError();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment