Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony 6 can't send email with mailer (without configured database)

Hello guys i just started to building web using Symfony6 - im trying to send email using mailer however it somehow require database to be configured (+ some special table created for messages...).Maybe there is some workaround so it would work without DB.. - thing is in Symfony 5 there was no problem with that.

like image 244
drcwycior Avatar asked Oct 12 '25 17:10

drcwycior


1 Answers

By default it's configured to work in async mode via messenger, that's why @glukose 's answer works. It sets sync mode and emails are sent immediately that way.

Your messenger is configured to work via Doctrine, that's why it requires DB. Like this: MESSENGER_TRANSPORT_DSN=doctrine://default

You can use many other options, like Redis or AMQP, async mode is used for a reason after all.

Anyway async mode won't work without workers started with command php bin/console messenger:consume async. That was my problem because I wasn't aware about what was used. No errors, but emails are not actually sent with Symfony mailer!