PHPackages                             a2design-company/sendgrid-webapi-cakephp-plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. a2design-company/sendgrid-webapi-cakephp-plugin

ActiveCakephp-plugin[API Development](/categories/api)

a2design-company/sendgrid-webapi-cakephp-plugin
===============================================

Sendgrid WebAPI CakePHP plugin

v1.0.1(10y ago)615.9k13[4 issues](https://github.com/a2design-inc/sendgrid-webapi-cakephp-plugin/issues)MITPHPPHP &gt;=5.3.0

Since May 8Pushed 8y ago18 watchersCompare

[ Source](https://github.com/a2design-inc/sendgrid-webapi-cakephp-plugin)[ Packagist](https://packagist.org/packages/a2design-company/sendgrid-webapi-cakephp-plugin)[ Docs](https://github.com/a2design-inc/sendgrid-webapi-cakephp-plugin)[ RSS](/packages/a2design-company-sendgrid-webapi-cakephp-plugin/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

CakePHP plugin for SendGrid WebAPI
==================================

[](#cakephp-plugin-for-sendgrid-webapi)

### Usage

[](#usage)

This plugin uses [CakeEmail class](http://book.cakephp.org/2.0/en/core-utility-libraries/email.html), and works almost the same.

Basic example:

```
App::uses('CakeEmail', 'Network/Email');
$email = new CakeEmail('sendGrid');

$email->to('recipient@domain.com');
$email->subject('Test email via SendGrid');
$email->send('Message');
```

More advanced example:

```
App::uses('CakeEmail', 'Network/Email');
$email = new CakeEmail('sendGrid');

$email->template('default', 'default');
$email->emailFormat('html');
$email->viewVars(array('name' => 'Your Name'));
$email->to(array('recipient1@domain.com' => 'Recipient1', 'recipient2@domain.com' => 'Recipient2'));
$email->subject('Test email via SendGrid');
$email->addHeaders(array('X-Tag' => 'my tag'));
$email->attachments(array(
    'cake.icon.png' => array(
        'file' => WWW_ROOT . 'img' . DS . 'cake.icon.png'
	)
));

$email->send();
```

The syntax of all parameters is the same as the default [CakeEmail class](http://book.cakephp.org/2.0/en/core-utility-libraries/email.html):

### Installation

[](#installation)

You can clone the plugin into your project:

```
cd path/to/app/Plugin
git clone git@github.com:a2design-company/sendgrid-webapi-cakephp-plugin.git Sendgrid

```

Bootstrap the plugin in app/Config/bootstrap.php:

```
CakePlugin::load('Sendgrid');
```

### Configuration

[](#configuration)

Create the file app/Config/email.php with the class EmailConfig.

```
