kevinzheng / laravel-switchable-mail
为Laravel提供支持多个可切换的运行时邮件驱动程序。
1.3
2016-11-26 04:07 UTC
Requires
- php: >=5.6.4
- illuminate/mail: 5.3.*
This package is not auto-updated.
Last update: 2024-09-28 20:03:48 UTC
README
它使得Laravel能够同时维护多个邮件驱动程序,并能够自动使用在运行时配置的指定邮件驱动程序向不同的邮件地址发送邮件。
说明
安装
-
使用Composer管理器安装此包
composer require kevinzheng/laravel-switchable-mail
-
替换
Illuminate\Mail\MailServiceProvider::class为KVZ\Laravel\SwitchableMail\MailServiceProvider::class在config/app.php文件中。 -
发布配置文件
php artisan vendor:publish --tag=switchable-mail
配置
它使用在 .env 中配置的 MAIL_DRIVER 作为默认邮件驱动程序,对于您想要使用指定邮件驱动程序发送的地址,请在其 switchable-mail.php 中进行配置。同时,您应该安装Laravel未提供的邮件驱动程序,例如阿里云的 Direct Mail 和 SendCloud。
```php
// 'directmail' => [
// 'qq.com', '163.com', '126.com', 'sina.com', 'sina.com.cn', 'sohu.com',
// ],
// 'mailgun' => [
// 'example.com',
// ],
```
提供两种邮件驱动程序
用法
无需做任何操作,只需像通常使用 Laravel Mail 一样即可。