我的适合发送电子邮件的控制器如下所示:
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);
// ...
}
}
Run Code Online (Sandbox Code Playgroud)
访问后/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"
Run Code Online (Sandbox Code Playgroud)
我的邮件程序配置如下所示:
Failed to authenticate on SMTP server with …Run Code Online (Sandbox Code Playgroud)