natatkinson
3/1/2013 - 5:44 PM

mandrill basic code for sending

mandrill basic code for sending

PHP Wrapper: https://packagist.org/packages/mandrill/mandrill

documentation to send:
https://mandrillapp.com/api/docs/messages.html

Code to Send HTML Email

$mandrill_api_key = "xxx-xxxxxxxxxxx";

//INCLUDE MANDRILL
include "/Mandrill.php";
$mandrill = new Mandrill($mandrill_api_key);
$mandrill_messages = new Mandrill_Messages($mandrill);


$html_content = "<h2>Hello</h2>
<p><a href='http://goo.gl/nKLP7'>Do it live</a></p>";

$send = array("html"=> $html_content,
		"subject"=> "Do it Live",
		"from_email"=> "from@email.com",
		"from_name"=> "Bill O'reily",
		"to"=> "to@email.com",
		"tags"=> array("Tag1",'Tag2")
	);
	
$tank = $mandrill_messages->send($send);
var_dump($tank);