PHP code example of statikbe / laravel-mail-template-engine
1. Go to this page and download the library: Download statikbe/laravel-mail-template-engine library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
statikbe / laravel-mail-template-engine example snippets
namespace Statikbe\LaravelMailEditor\Mails;
use Statikbe\LaravelMailEditor\AbstractMail;
class ResetPasswordMail extends AbstractMail
{
public static function name(){
return __('ResetPasswordTemplate');
}
public static function getContentVariables(){
return [
'url' => __('Reset password URL'),
];
}
public static function getRecipientVariables(){
return [
'user' => __('User'),
];
}
}
use Statikbe\LaravelMailEditor\Mails\ResetPasswordMail;
$contentVars = [
'nl' => [ //Optional wrap with locale
'url' => $verificationUrl,
],
];
$recipientVars = [
'user' => [
//Use an array with mail and optional locale
[
'mail' => $user->email,
'locale' => 'en',
],
//Or use an object
$user
]
];
$attachments = [
'nl' => [ //Optional wrap with locale
'user' => [
//Using laravel mail attach functionality
[
'path' => $path,
'options' => [
'as' => 'factuur.pdf',
'mime' => 'application/pdf',
]
],
//Or add an entire file
$file
],
]
];
$mail = new ResetPasswordMail();
$mail->sendMail($contentVars, $recipientVars);