Helthe Mandrill Component

dev-master / 1.0.x-dev 2014-05-14 16:19 UTC

This package is auto-updated.

Last update: 2020-03-30 03:23:08 UTC


Helthe Mandrill is a client library for interacting with the Mandrill API. It is currently designed to be a drop in alternative for sending emails with Mandrill. Features will be added over time to be closer to the official client library. However, for a feature complete client, you should use the official Mandrill client library.


Using Composer


Add the following in your composer.json:

    "require": {
        // ...
        "helthe/mandrill": "dev-master"

Using the command line

$ composer require 'helthe/mandrill=dev-master'



The Mandrill client uses a Guzzle client for interacting with the Mandrill API and the Symfony Serializer for serializing the data. The serializer is expected to have CustomNormalizer and the JsonEncoder.

use GuzzleHttp\Client as GuzzleClient;
use Helthe\Component\Mandrill\Client;
use Helthe\Component\Mandrill\Message\Message;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\CustomNormalizer;
use Symfony\Component\Serializer\Serializer.

// GuzzleHttp\ClientInterface
$guzzle = new GuzzleClient();
// Symfony\Component\Serializer\SerializerInterface
$serializer = new Serializer(array(new CustomNormalizer()), array(new JsonEncoder()));

$client = new Client($guzzle, $serializer, 'your_api_key');

$client->sendMessage(new Message('recipient@email.com', 'sender@email.com');


The mailer classes are design to hide internal workings of the library and offer a standard interface for sending messages. The package offers two mailer classes for you to use.


The Mailer class is used when you want to send regular text/HTML messages.


The TemplatingEngineMailer class is used when you want to render your message content with using a templating engine implementing the EngineInterfacefrom the Symfony Templating Component.


For bugs or feature requests, please create an issue.