daworks/ncloud-mailer-for-laravel6to8

Ncloud 云出口邮件驱动程序,适用于 Laravel

v1.0.2 2024-07-22 16:26 UTC

This package is auto-updated.

Last update: 2024-09-22 16:46:58 UTC


README

此包允许在 Laravel 6.x ~ 8.x 中使用 Ncloud Cloud Outbound Mailer 邮件驱动程序。

要求

  • PHP 7.2 或更高版本
  • Laravel 6.x, 7.x 或 8.x

安装

通过 Composer 安装此包

composer require daworks/ncloud-mailer-for-laravel6to8

配置

  1. 在 .env 文件中添加 Ncloud 认证信息

    认证信息是通过登录到 ncloud,然后在账户管理 > 认证键管理标签页中找到 Access Key ID 和 Secret Key 来输入的。

NCLOUD_AUTH_KEY=access_key_id
NCLOUD_SERVICE_SECRET=secret_key
  1. 配置文件发布
php artisan vendor:publish --provider="Daworks\NcloudMailer\NcloudMailerServiceProvider" --tag=config
  1. 在 config/mail.php 中添加新的邮件驱动程序
'mailers' => [
    'ncloud' => [
        'transport' => 'ncloud',
    ],
],

'default' => 'ncloud',
  1. 缓存配置文件。
@php artisan config:cache

使用

直接使用 Laravel 的常规邮件功能。例如

  • 使用 Mailable 发送
Mail::to($request->user())->send(new OrderShipped($order));
  • 使用 Notification 发送
Notification::route('mail', 'your@email.com')->notify(new TestNotification());

其他

Laravel 10.x 及以后版本,请参考以下链接。

https://github.com/Daworks/laravel-ncloud-mailer