mailer = $mailer; $this->twig = $twig; $this->senderEmail = $senderEmail; $this->senderName = $senderName; $this->supportUrl = $supportUrl; $this->wallabagUrl = $wallabagUrl; } /** * Send the auth code to the user via email. */ public function sendAuthCode(TwoFactorInterface $user): void { $template = $this->twig->load('TwoFactor/email_auth_code.html.twig'); $subject = $template->renderBlock('subject', []); $bodyHtml = $template->renderBlock('body_html', [ 'user' => $user->getName(), 'code' => $user->getEmailAuthCode(), 'support_url' => $this->supportUrl, 'wallabag_url' => $this->wallabagUrl, ]); $bodyText = $template->renderBlock('body_text', [ 'user' => $user->getName(), 'code' => $user->getEmailAuthCode(), 'support_url' => $this->supportUrl, ]); $email = (new Email()) ->from(new Address($this->senderEmail, $this->senderName ?? $this->senderEmail)) ->to($user->getEmailAuthRecipient()) ->subject($subject) ->text($bodyText) ->html($bodyHtml); $this->mailer->send($email); } }