1. Go to this page and download the library: Download freax/mandrill-zend2 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/ */
freax / mandrill-zend2 example snippets
use Mandrill\Mandrill;
use Mandrill\Struct\Message;
use 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);
use Mandrill\Mandrill;
use Mandrill\Struct\Message;
// convert from ZF message
// $zfMessage is instance of \Zend\Mail\Message
$message = Message::convertZFMail($zfMessage);
// add any field you want
$message->metadata = ...;
// instantiate a client object
$mandrill = new Mandrill('your_api_key');
// send the message
$response = $mandrill->messages()->send($message);
bash
php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.