ebethus/laravel-elastic-email-driver

A Laravel Elastic Email Driver

Installs: 2 927

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 14

pkg:composer/ebethus/laravel-elastic-email-driver

1.0.2 2023-05-03 23:40 UTC

README

A Laravel mail driver for Elastic Email service.

Compatibility

  • Laravel: 9.x, 10.x, 11.x, 12.x
  • PHP: 8.0+

Installation

Install the package via Composer:

composer require ebethus/laravel-elastic-email-driver

Configuration

1. Add Elastic Email Credentials

Add the following configuration to your config/services.php:

'elastic_email' => [
    'key' => env('ELASTIC_KEY'),
    'account' => env('ELASTIC_ACCOUNT'),
],

2. Set Environment Variables

Add your Elastic Email credentials to your .env file:

ELASTIC_KEY=your-elastic-email-api-key
ELASTIC_ACCOUNT=your-elastic-email-account

3. Configure Mail Driver

For Laravel 9+, update your config/mail.php to add the Elastic Email mailer:

'mailers' => [
    // ... other mailers
    
    'elastic_email' => [
        'transport' => 'elastic_email',
    ],
],

Then set it as your default mailer in .env:

MAIL_MAILER=elastic_email

For older Laravel versions, set:

MAIL_DRIVER=elastic_email

Usage

This package integrates seamlessly with Laravel's mail system. Use Laravel's Mail facade as you normally would:

use Illuminate\Support\Facades\Mail;
use App\Mail\WelcomeEmail;

Mail::to('user@example.com')->send(new WelcomeEmail());

For more information on sending emails, refer to the Laravel Mail documentation.

License

This package is open-sourced software licensed under the MIT license.

Support

For issues or questions, please contact alberroteran@gmail.com.