deno028 / yii2-mailersend

MailerSend 的 Yii2 扩展

安装: 0

依赖: 0

建议: 0

安全: 0

星标: 0

关注者: 1

分支: 0

公开问题: 0

类型:yii2-extension

1.0.2 2023-04-14 07:23 UTC

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();
 * ~~~