Skip to content

Commit

Permalink
Replace ResettingMail with standard TemplatedEmail
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Aug 8, 2023
1 parent 1ce567e commit 594a572
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 71 deletions.
67 changes: 0 additions & 67 deletions src/Mailer/Mail/ResettingMail.php

This file was deleted.

12 changes: 8 additions & 4 deletions src/Mailer/SimpleResettingMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

namespace Nucleos\UserBundle\Mailer;

use Nucleos\UserBundle\Mailer\Mail\ResettingMail;
use Nucleos\UserBundle\Model\UserInterface;
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
use Symfony\Component\Mailer\Exception\TransportExceptionInterface;
use Symfony\Component\Mailer\MailerInterface as SymfonyMailer;
use Symfony\Component\Mime\Address;
Expand Down Expand Up @@ -48,14 +48,18 @@ public function sendResettingEmailMessage(UserInterface $user): void
'token' => $user->getConfirmationToken(),
], UrlGeneratorInterface::ABSOLUTE_URL);

$mail = (new ResettingMail())
$mail = (new TemplatedEmail())
->textTemplate('@NucleosUser/Resetting/email.txt.twig')
->htmlTemplate('@NucleosUser/Resetting/email.html.twig')
->from(Address::create($this->fromEmail))
->to(new Address($user->getEmail()))
->subject($this->translator->trans('resetting.email.subject', [
'%username%' => $user->getUsername(),
], 'NucleosUserBundle'))
->setUser($user)
->setConfirmationUrl($url)
->context([
'user' => $user,
'confirmationUrl' => $url,
])
;

$this->mailer->send($mail);
Expand Down

0 comments on commit 594a572

Please sign in to comment.