PHP code example of jlinn / mandrill-api-php

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

    

jlinn / mandrill-api-php example snippets


use Jlinn\Mandrill\Mandrill;
use Jlinn\Mandrill\Struct\Message;
use Jlinn\Mandrill\Struct\Recipient;

// instantiate a client object
$mandrill = new Mandrill('your_api_key');

// instantiate a Message object
$message = new Message();

// define message properties
$message->text = 'Hello, *|NAME|*!';
$message->subject = 'Test';
$message->from_email = '[email protected]';
$message->from_name = 'Mandrill API Test';

// instantiate a Recipient object and add details
$recipient = new Recipient();
$recipient->email = '[email protected]';
$recipient->name = 'Recipient Name';
$recipient->addMergeVar('NAME', $recipient->name);

// add the recipient to the message
$message->addRecipient($recipient);

// send the message
$response = $mandrill->messages()->send($message);
bash
php composer.phar 

php artisan config:publish jlinn/mandrill-api-php