vibrant / laravel-elastic-email
通过 elastic email 驱动发送带附件的邮件的包
v1.0
2017-08-31 10:41 UTC
Requires
- laravel/framework: 5.4.x
This package is not auto-updated.
Last update: 2024-09-29 05:08:02 UTC
README
Elastic Email 的 Laravel 封装
可以发送带有多个附件的邮件
安装
- 步骤 1
使用 composer 安装包
composer require rdanusha/laravel-elastic-email
- 步骤 2
将以下代码添加到 .env 文件
ELASTIC_ACCOUNT=<Add your account>
ELASTIC_KEY=<Add your key>
- 步骤 3
在您的 .env 文件 中更新 MAIL_DRIVER 的值为 'elastic_email'
MAIL_DRIVER=elastic_email
- 步骤 4
将以下代码添加到您的 config/services.php 文件中
'elastic_email' => [
'key' => env('ELASTIC_KEY'),
'account' => env('ELASTIC_ACCOUNT')
]
- 步骤 5
打开 config/app.php 文件,进入 providers 数组,然后取消注释 Laravel 的默认 MailServiceProvider,并添加以下内容
'providers' => [ /* * Laravel Framework Service Providers... */ ... // Illuminate\Mail\MailServiceProvider::class, Rdanusha\LaravelElasticEmail\LaravelElasticEmailServiceProvider::class, ... ],
用法
此包与 Laravel 的原生邮件发送器完全相同。请参阅 Laravel 邮件文档。
https://laravel.net.cn/docs/5.5/mail
代码示例
Mail::to($request->user())->send(new OrderShipped($order));