I am trying to send Mandrill email to Laravel 4 Mailer by default and I want to install the template and send data to Mandrill. I would prefer not to use the local file in my Laravel, I have everything I need to work inside Mandrill. Here's how I installed it in Laravel:
Mail::send('emails.test',[],function($message) { $message->to(Input::get('email'), 'John Smith')->subject('Welcome!'); }); return
This sends an email from my "test" view inside the "emails" as it should. In vanilla PHP using the Mandrill library, this will work to send to the template I want.
$message = array( 'subject' => 'Subject redacted', 'from_email' => $main_email, 'to' => array(array('email' => $to_email)), 'merge_vars' => array(array( 'rcpt' => $to_email, 'vars' => array( array( 'name' => 'DETAIL', 'content' => $detail), array( 'name' => 'ERROR_AMOUNT', 'content' => '$'.$trans_amount) , array( 'name' => 'CO_NAME', 'content' => $business_name), array( 'name' => 'SMS', 'content' => $sms) )))); $template_name = 'Test Email'; $template_content = array( array( 'name' => 'main', ) ); $response = $mandrill->messages->sendTemplate($template_name, $template_content, $message);
source share