A CakePHP Component designed to easily integrate CakePHP with the wonderful service provided by SendGrid.com
Original coding: Dave Loftis (dave@lofdev.com)
Copyright (c) 2011 Dave Loftis.
Licensed: MIT LicenseLast Update: Feb 14, 2011 - 12:01 MST (GMT-6:00)
$this->SendgridEmail->sendEmail($params);
$params = array(
'to' => {recipient address}, REQUIRED - may be array
'subject => {subject}, REQUIRED
'from' => {sender address}, REQUIRED
'reply-to' => {reply to address},
'unique' => {unique id for x-SMTPAPI},
'category' => {category for sendgrid reports},
'layout' => {email layout filename},
'template' => {template filename},
'layout-type' => {[text|html|both]}, DEFAULT = both
'delivery-type' => {smtp}, DEFAULT = smtp
'merge-values' => array(
{keys} => {values},
{keys} => {values},.. For doing bulk messages with single call
)
);Copy entire repository into app/controllers/components/ directory
Add $sendgrid configuration to app/config/database.php (as immediately below)
var $sendgrid = array (
'port' => '25',
'timeout' => '30',
'host' => 'smtp.sendgrid.net',
'username' => '',
'password' => '',
'client' => 'smtp_helo_hostname',
'support_email' => 'your_administrative_address@domain.com'
);The support email address is used as the to-address when sending bulk emails, and does not receive anything, but is needed so that CakePHP does not think that and email without a normal SMTP to: address is invalid.
Code written and maintained by Dave Loftis. I am happy to help when and where I can but can't promise that I will be able to spend huge amounts of time helping you, but I will offer all the support I can.
- Basic support for SendGrid's EventAPI
Poorly planned init() function remains in place. New code should use sendEmail();
Also, you should add the support_email element to the $sendgrid database config.