Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/devside/mandrill

Mandrill module for Kohana 3
https://github.com/devside/mandrill

Last synced: 24 days ago
JSON representation

Mandrill module for Kohana 3

Awesome Lists containing this project

README

        

#Mandrill module for Kohana 3

This module allows you to communicate with Mandrill API 1.0

[Mandrill API documentation](https://github.com/kohana/kohana)
---

##Requirements
* PHP Curl extension

##Example

Asynchronous send with two recipients.

```php
// Email template
$view = View::factory('mailing/template');

// Email parameters
$params = array(
'html' => $view->render(),
'subject' => 'Test template',
'from_email' => '[email protected]',
'from_name' => 'Mr X',
'to' => array(
array(
'email' => '[email protected]'
),
array(
'email' => '[email protected]'
)
),
'preserve_recipients' => false,
'metadata' => array(
'page_id' => 1,
),
'recipient_metadata' => array(
array(
"rcpt" => "[email protected]",
"values" => array("id" => 1)
),
array(
"rcpt" => "[email protected]",
"values" => array("id" => 2)
),
)
);

// Send asynchronous email and receive Mandrill response
$resultJson = Mandrill::instance()->call(array(
'type' => 'messages',
'call' => 'send',
'message' => $params,
'async' => true
));
```