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

M2.3.3 breaks email sending when name contains non-ASCII char #24902

Closed
elvinristi opened this issue Oct 7, 2019 · 17 comments
Closed

M2.3.3 breaks email sending when name contains non-ASCII char #24902

elvinristi opened this issue Oct 7, 2019 · 17 comments
Assignees
Labels
Component: Email Fixed in 2.3.x The issue has been fixed in 2.3 release line 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 Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@elvinristi
Copy link
Contributor

elvinristi commented Oct 7, 2019

Preconditions (*)

  1. Magento M2.3.3

Steps to reproduce (*)

  1. Open registration or contact us page
  2. Enter correct details and as a name include some non-ASCII char, i.e some õäöü

Expected result (*)

  1. After registration user receives email
  2. No errors exist in var/log/exception.log

Actual result (*)

  1. User doesn't receive email
  2. 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;
@m2-assistant
Copy link

m2-assistant bot commented Oct 7, 2019

Hi @elvinristi. 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.

@elvinristi 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 Oct 7, 2019
@elvinristi
Copy link
Contributor Author

@magento give me 2.3-develop instance

@magento-engcom-team
Copy link
Contributor

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

@engcom-Bravo engcom-Bravo self-assigned this Oct 7, 2019
@m2-assistant
Copy link

m2-assistant bot commented Oct 7, 2019

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: 👇

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

@magento-engcom-team
Copy link
Contributor

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.

@elvinristi
Copy link
Contributor Author

elvinristi commented Oct 7, 2019

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

Sender Name settings

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

@engcom-Bravo engcom-Bravo added Component: Email 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 Oct 8, 2019
@ghost ghost unassigned engcom-Bravo Oct 8, 2019
@magento-engcom-team
Copy link
Contributor

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

@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 Oct 8, 2019
@elvinristi
Copy link
Contributor Author

elvinristi commented Oct 9, 2019

@engcom-Bravo , just make sure you link together MC-21567 and ENGCOM-6034 (#24906)

@m2-assistant
Copy link

m2-assistant bot commented Oct 10, 2019

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:

  • 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 2. 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!

  • 3. If the issue is not relevant or is not reproducible any more, feel free to close it.


@Karlasa Karlasa added Progress: PR Created Indicates that Pull Request has been created to fix issue and removed Progress: PR Created Indicates that Pull Request has been created to fix issue labels Oct 10, 2019
@engcom-Bravo
Copy link
Contributor

Hi @elvinristi. Unfortunately I have no access to MC-21567. But I hope Magento links such things together automatically.

@elvinristi
Copy link
Contributor Author

fixed in #24906

@elvinristi
Copy link
Contributor Author

#24906 merged

@elvinristi elvinristi added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Oct 14, 2019
@kovinet
Copy link

kovinet commented Dec 26, 2019

I am on Magento 2.3.3 and I still have this issue.

@andrewkett
Copy link
Contributor

andrewkett commented May 6, 2020

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;
     }

@utklasad
Copy link

utklasad commented May 7, 2020

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

@prasad1205
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Email Fixed in 2.3.x The issue has been fixed in 2.3 release line 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 Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development 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