wim niemans - 2021-01-07 16:20:07
The trait is very useful when you have to do a quick'n dirty job. Like bulk email.
Suppose you have to send a short email to a select user group. Just add the trait to your object $user and compose the short message.
Than $email = $user->parse($short_message, $variables).
Example of $short_message:
$short_message = <<<'EOSM'
Hello {userName),
you've registered at out website {website} on {register_date}. Thank you!.
This is a reminder to acknowledge that the registration reflects truely you. Please click <a href="{website}/{link}{userName}">here<a> or cut'n past the link {website}/{link}{userName} in your browser. Please acknowledge that this is you in the form. Thank you!
Greets from {website}.
<font size=-1>This email is sent to {email}, {firstName} {lastName}</font>
EOSM;
$variables = [
'register_date' => date("F j, Y, g:i a"),
'website' => 'https://example.com',
'link' => 'email_response.php?user='
];