PHP code example of fabian / mandrill

1. Go to this page and download the library: Download fabian/mandrill library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fabian / mandrill example snippets


$mail = new \Fabian\Mandrill\Message();
$mail->addTo('[email protected]', 'John Doe')
   ->setSubject('First email')
   ->setBody("Hi,\n\nthis is first email using Mandrill.")
   ->setFrom('[email protected]', 'Your Name')
   ->addTag('test-emails');
$mailer = new \Fabian\Mandrill\MandrillMailer(
    $this->context->parameters['mandrill']['apiKey']
);
$mailer->send($mail);

$mail = new \Nette\Mail\Message;
$mail->addTo('[email protected]', 'John Doe')
   ->setSubject('First email')
   ->setBody("Hi,\n\nthis is first email using Mandrill.")
   ->setFrom('[email protected]', 'Your Name')
$mailer = new \Fabian\Mandrill\MandrillMailer(
    $this->context->parameters['mandrill']['apiKey']
);
$mailer->send($mail);

$mailer->sendTemplate($mail, 'template_name', array(
    array('name' => 'header', 'content' => 'testing header'),
));