我的适合发送电子邮件的控制器如下所示:
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);
// ...
}
}
访问后/email
我收到以下错误:
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"
我的邮件配置如下所示:
framework:
mailer:
dsn: 'smtp://XXX:YYY@email-smtp.eu-central-1.amazonaws.com:465'
我想补充一点,我 XXX 和 YYY 是从 这里获得的 AWS 凭证