Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A very simple component to use the Sendgrid API inside CakePHP

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 controllers
Octocat-spinner-32 README.markdown

Sendgrid CakePHP component

Copyright 2011, Damien Varron Licensed under The MIT License Redistributions of files must retain the above copyright notice.


Written for CakePHP 1.3+


Add the following lines to your core configuration file with your own credentials:

Configure::write('Sendgrid.username', '');
Configure::write('Sendgrid.password', 'yourpassword');


This component extends the base CakePHP email component, and works virtually the same.

Place the sendgrid.php file in your app/controllers/components/ folder.

In your controller, make sure the component is available:

public $components = array('Sendgrid');   

Then, simply send messages like this:

$this->Sendgrid->delivery = 'sendgrid';
$this->Sendgrid->from = '';
$this->Sendgrid->to = '';
$this->Sendgrid->subject = 'this is the subject';
$messageBody = 'this is the message body';

The syntax of all parameters is the same as the default CakePHP email component:

For more information, see the Sendgrid API documentation:


You can see the response from Sendgrid in the return value when you send a message:

$result = $this->Sendgrid->send($messageBody);
$this->log($result, 'debug');
Something went wrong with that request. Please try again.