Search code examples
symfonysendmailsymfony-messenger

When I try to send an email, it is not sent, but stored in the messenger_messages table


  • create a new project Symfony
  • preparing users for enrollment setup symfony console make:user
  • create a registration form symfony console make:registration-form
  • do symfony composer require symfonycasts/verify-email-bundle to send emails upon registration
  • in .env write MAILER_DSN=...
  • make migrations and all that.
  • go to automatic route /register
  • I fill out the form and submit...

mail is sent via

$this->emailVerifier->sendEmailConfirmation('app_verify_email', $user,
            (new TemplatedEmail())
                ->from(new Address('***@***.com', 'My_Sender'))
                ->to($user->getEmail())
                ->subject('Please Confirm your Email')
                ->htmlTemplate('registration/confirmation_email.html.twig')
        );

Everything is standard. I haven't changed it by hand yet.

But, there are no mails.

In the table messenger_messages a new row appears, with the message.

I'm just studying symfony, and it's generally not clear to me how to force the letter to be sent, instead of (well, or at least after) saving it in a table messenger_messages.

In video, at the prompt of which I do all this, instead of saving it in a table - everything sent fine.

How can I send an e-mail?

I read the documentation, but so far I still don’t understand how to send a letter past the messenger.

So far, the only thing I have come up with is to create a new project with a minimum number of bundles, and install them manually one by one in order to skip the messenger. But that's not a solution.


Solution

  • Try to put: message_bus: false

    in your file config/packages/mailer.yaml

    like this:

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