Bonjour,
Je n'arrive pas à recevoir un email de confirmation après remplissage d'un formulaire d'inscription
Voici mon controller :
/**
* @Route("/inscription", name="user_registration", methods={"GET","POST"})
*/
public function registration(MailerInterface $mailer, Request $request, EntityManagerInterface $manager, UserPasswordEncoderInterface $encoder): Response
{
$user = new User();
$form = $this->createForm(UserType::class, $user);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$manager = $this->getDoctrine()->getManager();
$hash = $encoder->encodePassword($user, $user->getPassword());
$user->setPassword($hash);
$manager->persist($user);
$manager->flush();
$email = (new TemplatedEmail())
->from(new Address('contact@waloude.org', 'Waloude'))
->to(new Address($user->getEmail(), $user->getUsername()))
->subject('Confirmation de votre inscription Waloude!')
->htmlTemplate('email/welcome.html.twig')
->context([
//'user' => $user,
]);
$mailer->send($email);
return $this->redirectToRoute('app_login');
}
return $this->render('security/registration.html.twig', [
'user' => $user,
'form' => $form->createView(),
]);
}
Je mets ceci dans le fichier .env, j'utilise gmail:
MAILER_URL='smtp://smtp.gmail.com:465?encryption=tls&auth_mode=login&username=monmail@gmail.com&password=monpassword'
MAILER_DSN='smtp://smtp.gmail.com:465?encryption=tls&auth_mode=login&username=monmail@gmail.com&password=monpassword'
Après l'inscription l'utilisateur devrait recevoir un email de confirmation.
J'obtiens cette erreur :
https://tinyurl.com/ycgkr2rc
Merci d'avance