When it comes to build a great web application sending email in a reliable way can be an issue. SendGrid is one of the cloud-based email service on the corner that relieves businesses of the cost and complexity of maintaining custom email systems. SendGrid provides reliable delivery and scalability along with flexible API.
This extension wraps an reviewd version of the Alon Ben David's SendGrid PHP API and will let you send email with no latency and no need o wait replies from mail servers.
Add sendgrid extension to your main config file
'sendgrid'=>array( 'class' => 'ext.sendgrid.sendgrid', 'sg_user'=>'your_username', 'sg_api_key'=>'your_password', ),
Then you're able to call all methods implemented in sendgridWeb.php and sendgridNewsletter.php, I only made the mail_send($args) method accesible from the extension entrypoint sendgrid.php cause in my needs it will be the most used.
Sending an email through this extension is dead easy:
$recipients = array('email@example.com'); $recipientsName = array('RecName'); $result = Yii::app()->sendgrid->sendMail($recipients, $recipientsName, '', 'Subject', 'Sent with SendGrid from Mr Iacobelli', 'text', 'firstname.lastname@example.org', 'email@example.com', 'FromName', 'firstname.lastname@example.org');