symfony Mailer:不发送邮件并且没有错误

HAr*_*ron 1 php symfony symfony-mailer symfony6

我使用 Symfony6.2 Mailer 发送这样的电子邮件 文档

https://symfony.com/doc/current/mailer.html 但邮件未发送(我在收件箱中看不到任何新邮件)并且我没有任何错误?!我的邮件程序.yaml

\`\`\`framework:
    mailer:
        transports:
            main: '%env(MAILER_DSN)%'
Run Code Online (Sandbox Code Playgroud)

我尝试使用调试php bin/console mailer:test,当我使用此命令但当我使用路由功能时,邮件发送成功

    {
        $email = (new Email())
            ->from('hello@example.com')
            ->to('you@example.com')
            //->cc('cc@example.com')
            //->bcc('bcc@example.com')
            //->replyTo('fabien@example.com')
            //->priority(Email::PRIORITY_HIGH)
            ->subject('Time for Symfony Mailer!')
            ->text('Sending emails is fun again!')
            ->html('<p>See Twig integration for better HTML integration!</p>');

        $mailer->send($email);

        // ...
    }
}
Run Code Online (Sandbox Code Playgroud)

我没有收到任何邮件,我希望使用路由在收件箱中找到新邮件

HAr*_*ron 6

我解决了我的问题:在我的 config/packages/mailer.yaml 中添加选项 message_bus: false :

framework:
  mailer:
    dsn: '%env(MAILER_DSN)%'
    message_bus: false
Run Code Online (Sandbox Code Playgroud)