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

858 Views Asked by At

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('[email protected]')
            ->to('[email protected]')
            //->cc('[email protected]')
            //->bcc('[email protected]')
            //->replyTo('[email protected]')
            //->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

1

There are 1 best solutions below

1
HAron On BEST ANSWER

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