玫盲枚眉
var/log/exception.log
Invalid header value detected
[2019-10-07 11:33:57] report.CRITICAL: Invalid header value detected {"exception":"[object] (Magento\\Framework\\Exception\\MailException(code: 0): Invalid header value detected at vendor/magento/module-email/Model/Transport.php:104, Zend\\Mail\\Header\\Exception\\RuntimeException(code: 0): Invalid header value detected at vendor/zendframework/zend-mail/src/Header/HeaderValue.php:112)"}
````
Reasons:
- [ZF2 conforms only to RFC 2822](https://github.com/zendframework/zend-mail/blob/master/src/Header/HeaderValue.php#L65)
Potential fix is to add encoding in `vendor/magento/framework/Mail/Template/TransportBuilder.php`
```diff
--- vendor/magento/framework/Mail/Template/TransportBuilder.php.org 2019-10-07 17:16:16.946791204 +0200
+++ vendor/magento/framework/Mail/Template/TransportBuilder.php 2019-10-07 17:16:44.243320666 +0200
@@ -402,6 +402,7 @@
(string)$template->getSubject(),
ENT_QUOTES
);
+ $this->messageData['encoding'] = $mimePart->getCharset();
$this->message = $this->emailMessageInterfaceFactory->create($this->messageData);
return $this;
Hi @elvinristi. Thank you for your report.
To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento give me 2.3-develop instance
- upcoming 2.3.x release
For more details, please, review the Magento Contributor Assistant documentation.
@elvinristi do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
@magento give me 2.3-develop instance
Hi @elvinristi. Thank you for your request. I'm working on Magento 2.3-develop instance for you
Hi @engcom-Bravo. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Issue: Format is valid
will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid
appears.[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description
label to the issue by yourself.
[ ] 3. Add Component: XXXXX
label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.3-develop
branchDetails
- Add the comment @magento give me 2.3-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop
branch, please, add the label Reproduced on 2.3.x
.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 5. Add label Issue: Confirmed
once verification is complete.
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hi @elvinristi, here is your Magento instance.
Admin access: https://i-24902-2-3-develop.instances.magento-community.engineering/admin
Login: admin
Password: 123123q
Instance will be terminated in up to 3 hours.
Confirmed following on https://i-24902-2-3-develop.instances.magento-community.engineering
(can't see var/log/
files)
When including non-ASCII char in Sender Name-fields under Store Email Addresses
(n) and trying to subscribe to Newsletter from the footer then following message will be shown to frontend: Something went wrong with the subscription
.
(y) When removing special chars from "Sender Name" and re-trying newsletter subscribe, then message Thank you for your subscription
is presented to frontend.
:white_check_mark: Confirmed by @engcom-Bravo
Thank you for verifying the issue. Based on the provided information internal tickets MC-21567
were created
Issue Available: @engcom-Bravo, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._
@engcom-Bravo , just make sure you link together MC-21567
and ENGCOM-6034 (https://github.com/magento/magento2/pull/24906)
Hi @elvinristi. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:
Component: XXXXX
label(s) to the ticket, indicating the components it may be related to.[x] 2. Verify that the issue is reproducible on 2.3-develop
branchDetails
- Add the comment @magento give me 2.3-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop
branch, please, add the label Reproduced on 2.3.x
.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.
Hi @elvinristi. Unfortunately I have no access to MC-21567. But I hope Magento links such things together automatically.
I am on Magento 2.3.3 and I still have this issue.
We've worked around this on Magento 2.3.4 with the following composer patch on magento\framework
diff --git a/Framework/Mail/Address.php b/Framework/Mail/Address.php
index 18e1a8c72f2..7bf55e9fd3f 100644
--- a/Framework/Mail/Address.php
+++ b/Framework/Mail/Address.php
@@ -32,6 +32,11 @@ class Address
?string $email,
?string $name
) {
+
+ if (is_string($name) && $name != '') {
+ $name = iconv('UTF-8', 'ASCII//TRANSLIT', $name);
+ }
+
$this->email = $email;
$this->name = $name;
}
@andrewkett thanks! This fixed the issue for us on Magento 2.3.4. The other fixed mentioned here thats merged (#24906) is not enough of a solution for 2.3.4 (worked great in 2.3.3 since we applied it there). The strange part about this is that all our email communication stopped even if the $name only had a-z chars. But as I said the "hack" in /Framework/Mail/Address.php fixed all email communication.
@andrewkett I'm using you are solution but in the emails I'm seen if customer using the 盲, 眉. 枚 those are coverted into ?," . because of this my email name is not looking good and meshed up.
Please possible provide the solution.
thanks
Most helpful comment
I am on Magento 2.3.3 and I still have this issue.