-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
Magento 2.3.3 - Invalid header value detected #152
Comments
Will review shortly, but this seems like a core issue |
see magento/magento2#24902 which has fix in PR magento/magento2#24906 |
@elvinristi No, I have applied the changes here https://github.com/magento/magento2/pull/24906/files#diff-dfb3ee5a7f863458afea75f5524cd2e5R398 And I still have that Invalid Header error (and email not being sent) even with normal gmail addresses with normal characters. |
@elfeffe ... what version of our extension are you using 2.6.8? What version of Magento are you using? |
@srenon I applied the patch after I pened the issue here. Nothing, it always give the same error. |
which SMTP are you using (gmail, aws, etc)? |
Amazon SES and Mailgun, both do the same thing
|
@elfeffe ... I have zero issues on SES with Magento 2.3.3 and PHP 7.3, where are you seeing this issue so that I can check? |
I just noted that only happens with some addresses, very strange. |
Does the email/name contain special characters? Can you share a sample email address for me to test with? |
Hello, i have the same issue with Gmail. |
see also issue with Content-Disposition being as two possible hotfixes at the moment:
|
@srenon The name of the customer has special characters, not the address. |
@elfeffe I am experimenting the exact same issue. Did you find any solution / hotfix yet? |
@grll Not yet :( |
Using Magento 2.3.3 and gmail-smtp-app 2.6.8. problem seems to be in your module:
fromString() seems to convert all headers back to ASCII encoding. Removing this line worked for me and i'm trying to patch that in via composer. Since the comment mentions that that line is a temp fix, maybe it could be removed? |
I've added |
Instead of setting the encoding fixed to utf-8 the following patch can be used: --- vendor/magepal/magento2-gmailsmtpapp/Model/TwoDotThree/Smtp.php
+++ vendor/magepal/magento2-gmailsmtpapp/Model/TwoDotThree/Smtp.php
@@ -78,7 +78,9 @@
$dataHelper = $this->dataHelper;
$dataHelper->setStoreId($this->storeModel->getStoreId());
+ $encoding = $message->getEncoding();
$message = Message::fromString($message->getRawMessage());
+ $message->setEncoding($encoding);
//Set reply-to path
switch ($dataHelper->getConfigSetReturnPath()) { @srenon what's the status of the issue? Is a solution/fix in sight? |
As suggested here magepal#152 (comment)
@avoelkl Are you making a PR to fix this? |
In my case here the error was because the customer name had 'ô'. the same thing as @elfeffe has described. Did you find any fix to this? The only thing we are doing now is to replace the special chars of the customers until we find a solution for this. |
Based on this thread and the one on the magento2 repo I assembled this patch https://gist.github.com/lfglopes/a4d4eed2e8c0432fd8e60f0540a401fb it fixed it for me :) [no backport needed] |
We also had problems with Umlauts in recipient names. The PR didn't help for me. The following patch did:
|
@avoelkl @avstudnitz ... sorry for the delay I will review and accept this shortly |
Any timeline here? Would be nice if this is going to be merged in the next 1-2 days. It's just that the email sending does not work with this bug(?) 😒 |
@codedge ... done... please update to 2.7.0. |
@avoelkl, @avstudnitz @robsoned @lfglopes @DanieliMi @elfeffe I rewrite the way we are setting headers because most of the changes listed above only fix it for a particular version of Magento or language and cause issues in other environments. see fb78046#diff-abf392b7db6e57bed52c99468ffaa5f9R17 Please download 2.8.0 and let me know if you are still having issues |
This solution worked for me 🎉 ! if ($encoding) {
$this->message->setEncoding($encoding);
} So, I think the best practice use type in di.xml in your module without rewrite and plugins. <type name="Magento\Framework\Mail\EmailMessage">
<arguments>
<argument name="encoding" xsi:type="string">utf-8</argument>
</arguments>
</type> |
Using magento 2.3.3 and version 2.8.1 of this plugin didn't fix it for me. edit: the solution above works like a charm though. thanks @rafaelstz ! |
Magento version #:
2.3.3
Edition (EE, CE, OS, etc):
CE
Expected behavior:
Actual behavior:
Steps to reproduce:
Preconditions
SMTP Configuration version 2.6.6 - it's not possible to send emails to receipients containing special characters in their names.
main.CRITICAL: Invalid header value detected {"exception":"[object] (Zend\Mail\Header\Exception\RuntimeException(code: 0): Invalid header value detected at /var/www/magento2/vendor/zendframework/zend-mail/src/Header/HeaderValue.php:112)"} []
The text was updated successfully, but these errors were encountered: