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

Unable to send mail on Magento 2.2.8 with Arabic or Persian locale as Sender Name #22778

Closed
tuyennn opened this issue May 8, 2019 · 19 comments
Closed
Labels
Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed

Comments

@tuyennn
Copy link
Member

tuyennn commented May 8, 2019

Preconditions (*)

  1. Magento 2.2.8
  2. Persian or Arabic set as main locale

Steps to reproduce (*)

  1. Set sender Name for General Email a Persian or Arabic Name. Ex: نام فرستنده
  2. Well to send any email as Welcome or Order confirmation

Expected result (*)

  1. Email should be sent correctly without any issue

Actual result (*)

  1. Error exception throw: Invalid header value detected
  2. All mails failed to sent
@m2-assistant
Copy link

m2-assistant bot commented May 8, 2019

Hi @tuyennn. 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-engcom-team give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@tuyennn do you confirm that you was 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 May 8, 2019
@tuyennn
Copy link
Member Author

tuyennn commented May 8, 2019

@magento-engcom-team give me 2.3-develop instance

@magento-engcom-team
Copy link
Contributor

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

@magento-engcom-team
Copy link
Contributor

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

@tuyennn
Copy link
Member Author

tuyennn commented May 8, 2019

@magento-engcom-team confirmed issue on 2.3-develop instance No welcome email, order confirmation email.
Though from Magento 2.2.8 and Magento 2.3 the Zend Mail 1 was not exist and changed by Zend Mail 2 lib, in some kind the validation of Header was failed during mail send.

@tuyennn
Copy link
Member Author

tuyennn commented May 8, 2019

@AlexWorking AlexWorking self-assigned this May 8, 2019
@m2-assistant
Copy link

m2-assistant bot commented May 8, 2019

Hi @AlexWorking. 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-engcom-team 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. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 6. Add label Issue: Confirmed once verification is complete.

  • 7. Make sure that automatic system confirms that report has been added to the backlog.

@tuyennn tuyennn changed the title Unable to send mail on Magento 2.2.8 with Arabic or Persian locale Unable to send mail on Magento 2.2.8 with Arabic or Persian locale as Sender Name May 8, 2019
@tuyennn
Copy link
Member Author

tuyennn commented May 8, 2019

After debugging

vendor/zendframework/zend-mail/src/Header/HeaderValue.php
/**
     * Determine if the header value contains any invalid characters.
     *
     * @see    http://www.rfc-base.org/txt/rfc-2822.txt (section 2.2)
     * @param string $value
     * @return bool
     */
    public static function isValid($value)
    {
        $total = strlen($value);
        for ($i = 0; $i < $total; $i += 1) {
            $ord = ord($value[$i]);

            // bare LF means we aren't valid
            if ($ord === 10 || $ord > 127) {
                return false;
            }

            if ($ord === 13) {
                if ($i + 2 >= $total) {
                    return false;
                }

                $lf = ord($value[$i + 1]);
                $sp = ord($value[$i + 2]);

                if ($lf !== 10 || ! in_array($sp, [9, 32], true)) {
                    return false;
                }

                // skip over the LF following this
                $i += 2;
            }
        }

        return true;
    }

Just found out my Sender name was exceed int the ASCII value 127 characters and the validation was return false.

@mugua
Copy link

mugua commented Jun 28, 2019

@tuyennn I met the same issue using chinese words, how do you fix it ?
Mine: Magento 2.3.2+SMTP:Amasty
Thanks very much.

@tuyennn
Copy link
Member Author

tuyennn commented Jun 29, 2019

@mugua see ref issue and fix on above #22103

@mugua
Copy link

mugua commented Jun 29, 2019

@tuyennn , still can't find which is the right fix method on #22103
Could you show me on this post, Thanks.

@tuyennn
Copy link
Member Author

tuyennn commented Jun 30, 2019

@mugua
Use 2 ref here to create your own patch.
https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/Email/Model/Transport.php#L90
#22103 (comment)

For Amasty, please try to contact them for support. Or you could try to fix by yourself while adding

->setEncoding('utf-8')

To their own mail and transporter

@mugua
Copy link

mugua commented Jul 7, 2019

@tuyennn Well done, Fixed it now. Thanks a lot.

@ryandiamond23
Copy link

@magento-engcom-team give me 2.2.9 instance

@magento-engcom-team
Copy link
Contributor

Hi @ryandiamond23. Thank you for your request. I'm working on Magento 2.2.9 instance for you

@magento-engcom-team
Copy link
Contributor

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

@ryandiamond23
Copy link

@magento-engcom-team give me 2.3.1 instance

@magento-engcom-team
Copy link
Contributor

Hi @ryandiamond23. Thank you for your request. I'm working on Magento 2.3.1 instance for you

@magento-engcom-team
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed
Projects
None yet
Development

No branches or pull requests

5 participants