You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As the result of my investigations here #32487, i found, that when messenger is enabled, there is no possibility to disable it in mailer and this can cause problems.
For example when trying to retry failed TemplatedEmail message, mailer sends it to the next bus, and then serializer tries to call getBody from message, but there is no html and text parameters in instance yet, because BodyRenderer::render was not called.
And as the result you will see LogicException from Email:427
I don't know how to better solve this issue, but in my case i've just relinked MailerInterface to my custom mailer without bus inside.
Having the Messenger component is not enough for the emails to be sent via a bus. If you want to disable sending emails via the messenger, you need to remove the configuration for the SendEmailMessage class in your configuration.
Having the Messenger component is not enough for the emails to be sent via a bus. If you want to disable sending emails via the messenger, you need to remove the configuration for the SendEmailMessage class in your configuration.
Thanks, that really helped in a project with Symfony dependencies locked to 4.4 and symfony/mailer:^5.4.
We wanted to send mails asynchronously in prod and asynchronously in dev and test, so that we didn't have to call messenger:consume during tests to send emails. But we weren't able to use message_bus: false since it requires symfony/framework-bundle >= 5.1.
# config/packages/prod/messenger.yamlframework:
messenger:
routing:
'App\Message\PriceImport': async_import# use “…SendEmailMessage” only on prod environments,# so that emails are sent asynchronously on prod,# and synchronously on other environments'Symfony\Component\Mailer\Messenger\SendEmailMessage': async_mailer
As the result of my investigations here #32487, i found, that when messenger is enabled, there is no possibility to disable it in mailer and this can cause problems.
For example when trying to retry failed
TemplatedEmail
message, mailer sends it to the next bus, and then serializer tries to callgetBody
from message, but there is nohtml
andtext
parameters in instance yet, becauseBodyRenderer::render
was not called.And as the result you will see
LogicException
fromEmail:427
I don't know how to better solve this issue, but in my case i've just relinked
MailerInterface
to my custom mailer without bus inside.The text was updated successfully, but these errors were encountered: