mailer = $mailer; $this->templating = $templating; $this->from = $from; $this->reply = $reply; $this->name = $name; } protected function sendMessage($subject, $to, $body) { $mail = (new Email()) ->from(new Address($this->from, $this->name)) ->to($to) ->subject($subject) ->text($body) ->replyTo(new Address($this->reply, $this->name)); return $this->mailer->send($mail); } public function sendMailActivation(\App\Entity\User $user, $lien) { $subject = "Activation de votre compte"; $template = 'security/mail_activate.html.twig'; $to = $user->getMail(); $body = $this->templating->render($template, array('user' => $user, 'lien' => $lien)); $this->sendMessage($subject, $to, $body); } public function sendMailTokenMp(\App\Entity\User $user, $lien) { $subject = "Mot de passe perdu"; $template = 'security/mail_tokenmdp.html.twig'; $to = $user->getMail(); $body = $this->templating->render($template, array('user' => $user, 'lien' => $lien)); $this->sendMessage($subject, $to, $body); } }