yektadg/laravel-elastic-email

用于通过Elastic Email Mailer发送带附件的电子邮件的包。

1.0.1 2021-03-19 17:13 UTC

This package is not auto-updated.

Last update: 2024-09-19 16:47:59 UTC


README

Laravel Elastic Email是Elastic Email的包装器。您可以在项目中像使用Laravel原生邮件发送器一样发送电子邮件,该包确保通过Elastic Email API使用您的Elastic Email账户发送电子邮件。

要求

需要Laravel版本9或更高。

安装

  • 步骤1:通过composer安装包。
composer require yektadg/laravel-elastic-email
  • 步骤2:将您的账户和API密钥添加到您的.env文件。
ELASTIC_ACCOUNT=<Your public account key>
ELASTIC_KEY=<Your API key>
  • 步骤3:在.env文件中将MAIL_MAILER更新为'elastic_email'。
MAIL_MAILER=elastic_email
  • 步骤4:将此新邮件发送器添加到您的config/mail.php文件。
'mailers' => [
    ...
    'elastic_email' => [
        'transport' => 'elasticemail',
        'key' => env('ELASTIC_KEY'),
        'account' => env('ELASTIC_ACCOUNT')
    ],  
    ...
],
  • 步骤5:在您的config/app.php文件中,转到您的提供者数组,注释掉Laravel的默认MailServiceProvider,并添加以下包提供者
'providers' => [
    /*
     * Laravel Framework Service Providers...
     */
    ...
//    Illuminate\Mail\MailServiceProvider::class,
      \FlexFlux\LaravelElasticEmail\LaravelElasticEmailServiceProvider::class,
    ...
],

使用方法

阅读Laravel关于如何在Laravel框架中发送电子邮件的文档。

https://laravel.net.cn/docs/8.x/mail