PHP code example of stolfam / mandrill

1. Go to this page and download the library: Download stolfam/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/ */

    

stolfam / mandrill example snippets


$mandrill = new Ataccama\MandrillMailer(API_KEY, SUB_ACCOUNT);

$mandrill
    ->addFrom('[email protected]', 'Name')
    ->addTo('[email protected]')
    ->setSubject('Email subject')
    ->templateName('tmp-name');

$mandrill->addAttributes([
   'variable_key_1' => 'variable 1 content',
   'variable_key_2' => 'variable 2 content'
]);

addAttachment("filename.txt", "file content")

$mandrill
    ->addFrom('[email protected]')
    ->addTo('[email protected]', 'Name')
    ->setSubject('Events confirmation')
    ->setHtmlBody('<h1>Love you</h1><p>Soo <strong>much</strong>!</p>');

$mandrill->send();