If you want to send mandrill template not integrated with Mailchimp and by using Secret Key dynamically follow given steps
- Use https://packagist.org/packages/mandrill/mandrill package
- Run composer update
- In your controller 
use Mandrill;
public function sendmail(){
    // if required to set Mandrill secret key dynamically
    Config::set('services.mandrill.secret', 'xxxxxxxxxxxx');
    $mandrill = new Mandrill(Config::get('services.mandrill.secret')); 
    $message = array(
            'subject' => 'My subject',
            'to' => array(array('email' => 'recipient@gmail.com', 'name' => 'XYZ')),
                    'from_email' => 'admin@example.com',
            'merge_vars' => array(array(
                'rcpt' => 'recepient@gmail.com',
                'vars' =>
                array(
                    array(
                        'name' => 'Rashi',
                        'content' => 'Hello World!'),
                    array(
                        'name' => 'Goyal',
                        'content' => Hi !')
            ))));
        $templte_name = 'MANDRILL-TEMPLATE-NAME';
                // if required to send custom template with text
                $custom_template = " array(
            array(
                'name' => 'Testing template',
                'content' => 'Hi Testing custom'),
          ) ";
                $message = $mandrill->messages->sendTemplate($templte_name,$custom_template, $message);
}
                       
                    
0 Comment(s)