Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Mail][Messenger] losing email's transport header on error #44741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Nommyde opened this issue Dec 21, 2021 · 1 comment
Closed

[Mail][Messenger] losing email's transport header on error #44741

Nommyde opened this issue Dec 21, 2021 · 1 comment

Comments

@Nommyde
Copy link
Contributor

Nommyde commented Dec 21, 2021

Symfony version(s) affected

5.4

Description

When an email is sent through the messenger using alternative mail transport and if this mail transport fails then modified email is pushed to the queue for the next try (without X-Transport header). The second try takes default mail transport whether you want it or not.

How to reproduce

https://github.com/Nommyde/mailer-messenger-bug

run:

php bin/console app:send-email -vvv              # an email pushed to the queue
php bin/console mes:consume async --limit=1 -vvv # error on the second transport
php bin/console mes:consume async --limit=1 -vvv # success on the first transport

Possible Solution

In this case I believe the method \Symfony\Component\Mailer\Transport\Transports::send should clone a message before modifying and sending it.

Additional Context

No response

@PhilETaylor
Copy link
Contributor

PhilETaylor commented Mar 1, 2022

hmm I think I just documented the same bug but without the messenger integration to replicate it - sorry - #45594

@fabpot fabpot closed this as completed Apr 27, 2022
fabpot added a commit that referenced this issue Apr 27, 2022
This PR was merged into the 4.4 branch.

Discussion
----------

[Mailer] Restore X-Transport after failure

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #44741
| License       | MIT
| Doc PR        |

Restores X-Transport header for retries after failure.

Commits
-------

635e995 [Mailer] Restore X-Transport after failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants