Skip to content

juzaweb/email-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

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('[email protected]')
    ->setParams([
        'name' => 'The Anh',
    ])
    ->send();

License

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