-
-
Save sachsy/add75446bfedb86a7385 to your computer and use it in GitHub Desktop.
Sample Send with Mandrill Using tags and templates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'Mandrill.php'; | |
$mandrill = new Mandrill('YOUR_API_KEY'); | |
$message = array( | |
'subject' => 'My subject', | |
'from_email' => '[email protected]', | |
'to' => array(array('email' => '[email protected]', 'name' => 'Marc')), | |
'merge_vars' => array(array( | |
'rcpt' => '[email protected]', | |
'vars' => | |
array( | |
array( | |
'name' => 'FIRSTNAME', | |
'content' => 'Recipient 1 first name'), | |
array( | |
'name' => 'LASTNAME', | |
'content' => 'Last name') | |
)))); | |
$template_name = 'YOUR-TEMPLATE-NAME'; | |
$template_content = array( | |
array( | |
'name' => 'main', | |
'content' => 'Hi *|FIRSTNAME|* *|LASTNAME|*, thanks for signing up.'), | |
array( | |
'name' => 'footer', | |
'content' => 'Copyright 2013.') | |
); | |
$response = $mandrill->messages->sendTemplate($template_name, $template_content, $message); | |
print_r($response); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment