Skip to content

Instantly share code, notes, and snippets.

@Sleavely
Created January 13, 2015 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sleavely/653aae0c85c9e1fcbc20 to your computer and use it in GitHub Desktop.
Save Sleavely/653aae0c85c9e1fcbc20 to your computer and use it in GitHub Desktop.
<?php
$errand = foo();
$order = bar();
// Email the customer a receipt
$mail = Mail::send('returns.emails.approved', array('data' => 'to', 'the' => 'view'), function($message) use ($errand, $order)
{
// The "use" keyword allows us to access external variables in our anonymous function
$message
->to($order['customer_email'], $order['customer_firstname'].' '.$order['customer_lastname'])
->subject(Lang::get('returns.email.subject', array('returnid' => $errand->increment_id.'#'.$errand->id)));
// Categorize email for Mandrill
$headers = $message->getHeaders();
$headers->addTextHeader('X-MC-Tags', 'returns');
$headers->addTextHeader('X-MC-Track', 'opens,clicks_all');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment