tadcms/email-template

Add and manager email template for Laravel

v1.0.2 2021-04-18 15:27 UTC

This package is auto-updated.

Last update: 2024-12-11 19:20:21 UTC


README

Add and manager email template for Laravel

Features

  • Email template table
  • Add/Edit/Manager email template
  • Mail list send history
  • Send mail with cronjob

Install

  • Install package
composer require tadcms/laravel-email-template
  • Migration
php artisan migrate
  • Setup The Scheduler: Add command to your server
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

View more: Starting The Scheduler

Usage

Make Email Template

use Tadcms\EmailTemplate\Models\EmailTemplate;

EmailTemplate::create([
    'code' => 'test_mail',
    'subject' => 'Send email test for {name}',
    'body' => '<p>Hello {name},</p>
               <p>This is the test email</p>',
    'params' => [
        'name' => 'Your Name',
    ],
]);

Send email with template

use Tadcms\EmailTemplate\EmailService;

EmailService::make()
    ->withTemplate('test_mail')
    ->setEmails('test@example.com')
    ->setParams([
        'name' => 'The Anh',
    ])
    ->send();

License

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