kevinzheng/laravel-switchable-mail

为Laravel提供支持多个可切换的运行时邮件驱动程序。

1.3 2016-11-26 04:07 UTC

This package is not auto-updated.

Last update: 2024-09-28 20:03:48 UTC


README

它使得Laravel能够同时维护多个邮件驱动程序,并能够自动使用在运行时配置的指定邮件驱动程序向不同的邮件地址发送邮件。

说明

英文

简体中文

安装

  1. 使用Composer管理器安装此包

    composer require kevinzheng/laravel-switchable-mail
  2. 替换 Illuminate\Mail\MailServiceProvider::classKVZ\Laravel\SwitchableMail\MailServiceProvider::classconfig/app.php 文件中。

  3. 发布配置文件

    php artisan vendor:publish --tag=switchable-mail

配置

它使用在 .env 中配置的 MAIL_DRIVER 作为默认邮件驱动程序,对于您想要使用指定邮件驱动程序发送的地址,请在其 switchable-mail.php 中进行配置。同时,您应该安装Laravel未提供的邮件驱动程序,例如阿里云的 Direct MailSendCloud

```php
// 'directmail' => [
//     'qq.com', '163.com', '126.com', 'sina.com', 'sina.com.cn', 'sohu.com',
// ],

// 'mailgun' => [
//     'example.com',
// ],
```

提供两种邮件驱动程序

laravel-directmail

laravel-sendcloud

用法

无需做任何操作,只需像通常使用 Laravel Mail 一样即可。

感谢

ElfSundae