moein7tl / yii2-mailgun
此包已被放弃且不再维护。未建议替代包。
Yii2框架的Mailgun集成
v0.0.4
2017-04-21 20:28 UTC
Requires
- mailgun/mailgun-php: ~2.1.2
- yiisoft/yii2: >=2.0.4
This package is not auto-updated.
Last update: 2021-11-19 23:46:48 UTC
README
Yii框架的Mailgun集成
安装
安装此扩展的首选方式是通过 composer。
运行以下命令之一
php composer.phar require --prefer-dist moein7tl/yii2-mailgun "*"
或
"moein7tl/yii2-mailgun": "*"
将以下内容添加到你的 composer.json 文件的 require 部分中。
使用方法
在应用配置中配置它
'components' => [ ... 'mailer' => [ 'class' => 'moein7tl\mailgun\Mailer', 'key' => 'key-example', 'domain' => 'mg.example.com', ], ... ],
要发送邮件,你可以使用以下代码
Yii::$app->mailer->compose('contact/html', ['contactForm' => $form]) ->setFrom('from@domain.com') ->setTo($form->email) ->setSubject($form->subject) ->send();