-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Mailer] [Mailgun] Fix outlook sender #51773
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
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
Hey! Thanks for your PR. You are targeting branch "6.4" but it seems your PR description refers to branch "6.4 for bug fixes". Cheers! Carsonbot |
06ec3b0
to
c1972ca
Compare
c1972ca
to
09d49f9
Compare
Thank you @Romanavr. |
It seems like this change is causing issues for me, when sending mails to Gmail accounts via Mailgun.
After some digging, it seems my sent message contains 2 sender headers, one capitalized and one not:
I am still trying to figure out where the capitalized "Sender" header gets added in my flow, but haven't pinned that down yet. I am not familiar enough with email headers, but if it is considered best practice to capitalize them, then maybe the custom header added via this change should also be capitalized? |
I just tested - everything is ok for me, what transport type are you using? API? |
@Romanavr yes API. |
I was able to reproduce. Indeed, good point about capitalize the header. |
@svendecabooter Please try 52017#fix and let me know if it works for you |
This PR was squashed before being merged into the 6.3 branch. Discussion ---------- [Mailer] Capitalize sender header for Mailgun | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #51773 (comment) | License | MIT This fix resolves the duplicate header issue. Without a fix, using API & HTTP transport type, emails could leave with double headers, causing problems for some email providers, for example, the problem was reproduced with Gmail: `5.7.1 This message is not RFC 5322 compliant. There are multiple Sender 5.7.1 headers. To reduce the amount of spam sent to Gmail, this message has 5.7.1 been blocked.` Moreover, I found that changes to HTTP transport type were not necessary since this problem could be solved by simply adding a sender, so I reverted everything for HTTP transport type. Commits ------- eb394bb [Mailer] Capitalize sender header for Mailgun
Hello, I have come across a problem caused by this change. The header h:Sender is added here as UnstructuredHeader. When it is added into payload here, sometimes it encodes incorrectly The issue occurs only in some cases when using Sender Address with name part with diacritics, because of the difference in encoding of UnstructuredHeader and MailboxHeader. example: $unstructuredHeader = new UnstructuredHeader('From', '"Klaudie Šulcová" <foo@bar.com>');
$mailboxHeader = new MailboxHeader('From', new Address('foo@bar.com', 'Klaudie Šulcová'));
$unstructuredHeader->getBodyAsString(), // ""Klaudie =?utf-8?Q?=C5=A0ulcov=C3=A1=22?= <foo@bar.com>"
$mailboxHeader->getBodyAsString() // "Klaudie =?utf-8?Q?=C5=A0ulcov=C3=A1?= <foo@bar.com>" I discovered this problem because some mailservers complained about the Sender header being invalid. A simple solution to fix this problem would be adding the $headers->addMailboxHeader('h:Sender', $envelope->getSender()); I'll send a PR |
This PR was submitted for the 6.4 branch but it was squashed and merged into the 6.3 branch instead. Discussion ---------- [Mailer] [Mailgun] Fix sender header encoding | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #51773 (comment) | License | MIT This adjustment fixes a problem with header encoding in MailgunApiTransport. The issue occurs only in some cases when using Sender Address with name part with diacritics, because of the difference in encoding of UnstructuredHeader and MailboxHeader. It changes the method used to add header `h:Sender` so that MailboxHeader is used. Commits ------- 0f3b2f7 [Mailer] [Mailgun] Fix sender header encoding
This PR solves the problem related to displaying the sender in the OutLook email client when sending an email from a subdomain.
Check more details by following these links:
https://serverfault.com/questions/1097879/sender-and-from-header-domain-mismatch-causes-malformed-display-in-outlook
https://stackoverflow.com/questions/28401673/removing-on-behalf-of-when-sending-mail-using-mailgun/45445015#45445015