My controller which is suitable for sending emails looks like this:
class MailerController extends AbstractController
{
/**
* @Route("/email")
*/
public function sendEmail(MailerInterface $mailer): Response
{
$email = (new Email())
->from('hello@example.com')
->to('you@example.com')
->subject('Time for Symfony Mailer!')
->text('Sending emails is fun again!')
$mailer->send($email);
// ...
}
}
After visiting /email
I am getting the following error:
Failed to authenticate on SMTP server with username "XXX" using the following authenticators: "LOGIN", "PLAIN". Authenticator "LOGIN" returned "Symfony\Component\Mailer\Exception\TransportException: Expected response code "235" but got code "535", with message "535 Authentication Credentials Invalid"
My mailer config looks like this:
framework:
mailer:
dsn: 'smtp://XXX:YYY@email-smtp.eu-central-1.amazonaws.com:465'
I would like to add that I XXX and YYY are AWS credentials obtained from here