magento2: M2.3.3 breaks email sending when name contains non-ASCII char
Preconditions (*)
- Magento M2.3.3
Steps to reproduce (*)
- Open registration or contact us page
- Enter correct details and as a name include some non-ASCII char, i.e some
õäöü
Expected result (*)
- After registration user receives email
- No errors exist in
var/log/exception.log
Actual result (*)
- User doesn’t receive email
- Log includes Exception with message
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:
Potential fix is to add encoding in vendor/magento/framework/Mail/Template/TransportBuilder.php
--- 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;
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 6
- Comments: 17 (11 by maintainers)
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
fixed in https://github.com/magento/magento2/pull/24906