deno028 / yii2-mailersend
MailerSend 的 Yii2 扩展
1.0.2
2023-04-14 07:23 UTC
Requires
- mailersend/mailersend: ^0.9.1
- yiisoft/yii2: >=2.0.4
Requires (Dev)
- nyholm/psr7: ^1.5
- php-http/guzzle7-adapter: ^1.0
This package is auto-updated.
Last update: 2024-09-24 16:13:06 UTC
README
MailerSend 的 Yii2 扩展
安装
安装此扩展的首选方法是使用 composer。
运行以下命令之一
php composer.phar require --prefer-dist deno028/yii2-mailersend "*"
或在您的 composer.json
文件的 require 部分添加以下内容
"deno028/yii2-mailersend": "*"
使用方法
扩展安装完成后,只需在您的代码中通过以下方式使用它
* Mailer implements a mailer based on MailerSend.
*
* To use Mailer, you should configure it in the application configuration like the following,
*
* ~~~
* 'components' => [
* ...
* 'mailer' => [
* 'class' => 'deno028\mailersend\Mailer',
* 'key' => 'key-example',
* ],
* ...
* ],
* ~~~
*
* To send an email, you may use the following code:
*
* ~~~
* Yii::$app->mailer->compose('contact/html', ['contactForm' => $form])
* ->setFrom('from@domain.com')
* ->setTo($form->email)
* ->setSubject($form->subject)
* ->send();
* ~~~