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

Time:11-03

  • 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. the code is fully automatic, I haven't changed it by hand yet.

all OK. no mistakes

BUT! there are no letters.

but in the table messenger_messages a new message appears.

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 a letter?

if you just tell me how to turn off messenger so that letters are sent without his help, it will work too :)

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 at all :)

CodePudding user response:

Try to put: message_bus: false

in your file config/packages/mailer.yaml

like this:

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