Yii SendGrid ¶
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.
Requirements ¶
- Yii 1.1
- SendGrid Account
Usage ¶
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('recipent@domain.com');
$recipientsName = array('RecName');
$result = Yii::app()->sendgrid->sendMail($recipients, $recipientsName, '', 'Subject', 'Sent with SendGrid from Mr Iacobelli', 'text', 'sender@mail.com', 'anyone@domain.com', 'FromName', 'whosgonnaanswer@domain.com');
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.