sweelix/yii2-sendgrid
最新稳定版本:1.1.0
Composer 安装命令:
composer require sweelix/yii2-sendgrid
包简介
PHP 5.6+ Sendgrid integration for the Yii framework
README 文档
README
This extension allow the developper to use Sendgrid as an email transport.
Installation
If you use Packagist for installing packages, then you can update your composer.json like this :
{
"require": {
"sweelix/yii2-sendgrid": "*"
}
}
Howto use it
Add extension to your configuration
return [ //.... 'components' => [ 'mailer' => [ 'class' => 'sweelix\sendgrid\Mailer', 'token' => '<your sendgrid token>', ], ], ];
You can send email as follow (using postmark templates)
Yii::$app->mailer->compose('contact/html') ->setFrom('from@domain.com') ->setTo($form->email) ->setSubject($form->subject) ->setTemplateId(12345) ->setTemplateModel([ 'firstname' => $form->firstname, 'lastname' => $form->lastname, ->send();
For further instructions refer to the related section in the Yii Definitive Guide
Running the tests
Before running the tests, you should edit the file tests/_bootstrap.php and change the defines :
// ... define('SENDGRID_FROM', '<sender>'); define('SENDGRID_TOKEN', '<token>'); define('SENDGRID_TO', '<target>'); define('SENDGRID_TEMPLATE', 575741); define('SENDGRID_TEST_SEND', false); // ...
to match your Sendgrid configuration.
Contributing
All code contributions - including those of people having commit access - must go through a pull request and approved by a core developer before being merged. This is to ensure proper review of all the code.
Fork the project, create a feature branch , and send us a pull request.
统计信息
- 总下载量: 714
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2016-11-02