Mailer (class)
Class Mailer
Mailer base class.
Mailer classes let you encapsulate related Email logic into a reusable and testable class.
Defining Messages
Mailers make it easy for you to define methods that handle email formatting logic. For example:
class UserMailer extends Mailer { public function resetPassword($user) { $this ->subject('Reset Password') ->to($user->email) ->set(['token' => $user->token]); } }
Is a trivial example but shows how a mailer could be declared.
Sending Messages
After you have defined some messages you will want to send them:
$mailer = new UserMailer(); $mailer->send('resetPassword', $user);
Event Listener
Mailers can also subscribe to application event allowing you to decouple email delivery from your application code. By re-declaring the i