I try to send email with symfony. I use this code :
$email = (new TemplatedEmail())
->from('myemail@mydomain.com')
->to('mypersonnaltestingemail@gmail.com')
->subject('Nouvelle demande de devis !')
->htmlTemplate('email/email_project_ask.html.twig')
->context([
'projectAsk' => $projectAsk,
])
;
try {
$this->mailer->send($email);
} catch (TransportExceptionInterface $e) {
return new RedirectResponse($this->router->generate('app_404_error'));
}
Previously, the same code sent emails, I could not explain what have changed and provoke an error. I writed in my .env file the mailer DSN and even tried to change it (the password for example).
MAILER_DSN=smtp://myemail@mydomain.com:mypassword@mx1.mail.ovh.net
In the profiler, the email is "sent" from the email written in the function.
Image of the profiler which displays that email is sent
But in the facts, when I connect to mypersonnaltestingemail@gmail.com, in my mailbox, I don't see the email...
Can someone could explain me where is the problem and how i can solve it? In the DSN? I am working online in a testing domain like test.mydomain.com... Previously the function and the mailer DSN worked...