urbanindo / yii2-mail-object
这个包裹将Yii2邮件器作为对象封装
v1.0
2018-06-22 08:03 UTC
Requires
- php: >=7.0
- yiisoft/yii2: >=2.0.13
Requires (Dev)
- phing/phing: ~2.16.1
- phpunit/php-code-coverage: ~5.3.2
- phpunit/phpunit: ~6.5.8
- yiisoft/yii2-swiftmailer: ~2.0.0
This package is auto-updated.
Last update: 2024-09-22 17:12:01 UTC
README
这封装了可以实例化的邮件对象。
用法
使用 MailObject 创建新的邮件对象类。
例如:
class DummyMail extends MailObject { protected function getSubject(): string { return 'Hello, World!'; } protected function getContentParams(): array { return [ 'recipientName' => 'Jane Doe', ]; } protected function getRecipient(): array { return [ 'jane.doe@example.com' => 'Jane Doe', ]; } }
为HTML格式和纯文本电子邮件分别创建 html.php 和 text.php。
要发送对象,只需简单执行。
$mail = new DummyMail(); $mail->send();
测试
要运行测试,执行
./vendor/bin/phing test