Skip to content

lofdev/CakePHP-SendGrid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

CakePHP-SendGrid Component

Copyright

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 License

Last Update: Feb 14, 2011 - 12:01 MST (GMT-6:00)

Usage (from controller):

$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
	)	
);

Installation:

Copy entire repository into app/controllers/components/ directory

Configuration:

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.

More information:

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.

Additional features coming soon, including:

  • Basic support for SendGrid's EventAPI

Legacy Users:

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.

About

CakePHP Component to enable SendGrid X-SMTPAPI Integration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages