Skip to content

Latest commit

 

History

History
53 lines (38 loc) · 1.81 KB

mail.md

File metadata and controls

53 lines (38 loc) · 1.81 KB

Mail

Send mail

EmailHandler::send(string $content, string $title, ['name' => string $reciever_name, 'to' => string $reciever_email]);

Ex:

EmailHandler::send('Hello there', 'Test email', ['name' => 'Sang Nguyen', 'to' => 'sangit7b@gmail.com']);

Email content with parameters: core/acl/src/Http/Controllers/AuthController.php:151

$data = [
    'user' => $user->username,
    'token' => $reminder->code,
    'name' => $user->getFullName(),
    'email' => $user->email,
];

EmailHandler::send(
    view('acl::emails.reminder', $data)->render(), 
    trans('acl::auth.email.invite.title'),
    ['name' => $user->getFullName(), 'to' => $user->email]
);

Email template

The email template is located in core/base/resources/views/system/email.blade.php

Email template

To use custom email template:

EmailHandler::setEmailTemplate(string $path_to_view);

Ex: Default email template setting

EmailHandler::setEmailTemplate('bases::system.email'); // config('cms.email_template')