phpsymfonysymfony6symfony-mailer

symfony Mailer : not sending mail and there's not error


i use Symfony6.2 Mailer to sent an email like this docs

https://symfony.com/doc/current/mailer.html but the mail is not sent (i cannnot see any new mail in the inbox ) and i dont have any errror?! my mailer.yaml

\`\`\`framework:
    mailer:
        transports:
            main: '%env(MAILER_DSN)%'

i tried to debug using php bin/console mailer:test ,the mail sent successfully nut when i use this command but when i use the Route function

    {
        $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);

        // ...
    }
}

i dont recieve any mail i exepct to find new mail in the inbox using the ROute


Solution

  • i resolved my problem with : add the option message_bus: false in my config/packages/mailer.yaml:

    framework:
      mailer:
        dsn: '%env(MAILER_DSN)%'
        message_bus: false