digimantra/digi-email

A laravel package to send email.

v1.0.2 2024-09-20 11:07 UTC

This package is not auto-updated.

Last update: 2025-03-08 08:31:28 UTC


README

Packagist Version Packagist Downloads GitHub License

Table of Contents

Requirements

  • Laravel 8, 9, or 10
  • PHP 8.0 or higher
  • Google API Client (installed automatically via composer)
  • Firebase account with Cloud Messaging API enabled

Installation

Install via Composer

composer require digimantra/digi-email

Configuration

Update SMTP Settings

Modify your .env file to include your SMTP credentials:

MAIL_MAILER=smtp
MAIL_HOST=smtp.yourservice.com
MAIL_PORT=587
MAIL_USERNAME=your_email@domain.com
MAIL_PASSWORD=your_password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=your_email@domain.com

Important: Clear the configuration cache with:

php artisan config:clear

Configure the Queue

Make sure you have set up your queue configuration in config/queue.php and have a queue driver configured (like database, Redis, etc.). If you're using the database driver, run the migration to create the jobs table:

php artisan queue:table
php artisan migrate

Usage

Invoke the package’s email-sending function and provide the $data array as follows:

$data = [
    'to' => 'user@email.com',
    'html' => true,
    'content' => '<h1>Hi, test email</h1>',
    'view' => '<path/to/view>',
    'attachment' => false,
];
EmailHelper::sendEmail($data);

The package will handle the rest.

Queueing Emails

To process queued jobs, execute the following command in your terminal:

php artisan queue:work

Composer Requirements

The package relies on phpmailer/phpmailer for SMTP handling and is compatible with Laravel versions 8.x, 9.x, and 10.x.

License

This package is released under the MIT License. Refer to the LICENSE file for details.

Support

For support or more details you can reach out at it@digimantra.com.