Skip to content
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

Email fail - Invalid header value detected #25542

Closed
rafaelstz opened this issue Nov 9, 2019 · 16 comments
Closed

Email fail - Invalid header value detected #25542

rafaelstz opened this issue Nov 9, 2019 · 16 comments
Assignees
Labels
Component: Mail Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@rafaelstz
Copy link
Member

Preconditions (*)

  1. Magento 2.3.3
  2. Change the Sender Name using punctuation.

Screen Shot 2019-11-09 at 11 56 09 AM

Steps to reproduce (*)

  1. You can access the contact form and fill the name using punctuation like Rafael Corrêa
  2. Or changing the Sender Name using punctuation.

Expected result (*)

  1. Send the email

Actual result (*)

  1. Receive the error message below.

Invalid header value detected

Screen Shot 2019-11-09 at 12 00 14 PM

@m2-assistant
Copy link

m2-assistant bot commented Nov 9, 2019

Hi @rafaelstz. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

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.

@rafaelstz do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Nov 9, 2019
@andrewbess andrewbess self-assigned this Nov 9, 2019
@m2-assistant
Copy link

m2-assistant bot commented Nov 9, 2019

Hi @andrewbess. 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: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label 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 branch

    Details- 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!


@rafaelstz
Copy link
Member Author

@magento give me 2.3-develop instance

@magento-engcom-team
Copy link
Contributor

Hi @rafaelstz. Thank you for your request. I'm working on Magento 2.3-develop instance for you

@magento-engcom-team
Copy link
Contributor

Hi @rafaelstz, here is your Magento instance.
Admin access: https://i-25542-2-3-develop.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

@andrewbess
Copy link

andrewbess commented Nov 11, 2019

Hello @rafaelstz
Magento uses "zendframework/zend-mail" to send emails.
This module validates headers according to RFC 2822.
Please take a look at this document (section 2.2).
As you can see, your sender name has the symbol "á" with code 195.
So, I think this task can be closed.
@magento-engcom-team how do you think about it?

@m2-assistant
Copy link

m2-assistant bot commented Nov 11, 2019

Hi @magento-engcom-team. 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: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label 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 branch

    Details- 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.

@rafaelstz
Copy link
Member Author

Hi @andrewbess,
But Magento's core requires the version, the Magento 2.3.2 doesn't have this issue.

@davidverholen
Copy link
Member

the same happens for order mails if the customer name contains non ascii characters. So this issue is valid and even pretty critical

@davidverholen davidverholen self-assigned this Nov 19, 2019
@m2-assistant
Copy link

m2-assistant bot commented Nov 19, 2019

Hi @davidverholen. 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: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label 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 branch

    Details- 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.

@davidverholen davidverholen added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Component: Mail Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Nov 19, 2019
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @davidverholen
Thank you for verifying the issue. Based on the provided information internal tickets MC-28945 were created

Issue Available: @davidverholen, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@magento-engcom-team magento-engcom-team added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Nov 19, 2019
@david-fuehr
Copy link
Contributor

This issue is a duplicate of #24902 and already fixed in MR #24906

@david-fuehr david-fuehr added Fixed in 2.3.x The issue has been fixed in 2.3 release line and removed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development labels Nov 21, 2019
@vipin12117
Copy link

vipin12117 commented Mar 17, 2020

Magento did not fixed in 2.3.4

@hanhpv
Copy link

hanhpv commented Mar 18, 2020

still happens on EE 2.3.3
If customer name contains special characters like this Rafael Corrêa. The order confirmation email failed to send, which is critical.

@rafaelstz
Copy link
Member Author

This solution worked for me 🎉 !
In the EmailMessage class vendor/magento/framework/Mail/EmailMessage.php the encoding can be set if passed in an argument in the constructor, but it is null by default.

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>

Reference: https://magento.stackexchange.com/a/306638/16416

@abdulrafay-systemsltd
Copy link

I am facing this issue in Magento EE ver. 2.3.2
Invalid header value detected {"exception":"[object] (Magento\Framework\Exception\MailException(code: 0): Invalid header value detected at /vendor/magento/module-email/Model/Transport.php:101,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Mail Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

8 participants