Prestashop: PS 1.7.5.0 - Mails issues, seem related to php intl and swiftmailer

Created on 20 Jan 2019  路  4Comments  路  Source: PrestaShop/PrestaShop

Describe the bug
Fresh install 1.7.5.0, yet the shop is unable to send a mail.
Tests made on the login admin panel, form "forget password".

(I have some other PS 1.5 on the same server which work correctly).

If I add the correct email to retrieve the password in the form, I got as error :

Fatal error: Uncaught exception 'Swift_RfcComplianceException' with message 'Address in mailbox given [contact@] does not comply with RFC 2822, 3.6.2.' in /home/myshop/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php:345 Stack trace: #0 /home/myshop/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php(261): Swift_Mime_Headers_MailboxHeader->_assertValidAddress('contact@') #1 /home/myshop/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php(106): Swift_Mime_Headers_MailboxHeader->normalizeMailboxes(Array) #2 /home/myshop/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php(63): Swift_Mime_Headers_MailboxHeader->setNameAddresses(Array) #3 /home/myshop/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/SimpleHeaderFactory.php(58): Swift_Mime_Headers_MailboxHeader->setFieldBodyModel(Array) #4 /home/myshop in /home/myshop/public_html/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php on line 345

if I comment the test at the line 345 in MailboxHeader.php... I still got an error "An error occurred while resetting the password."

If I use an email which dont exist, it just said that it don't exist. Note that I'm sure that the email is correct and RFC 2822 valid.

The function throw the error with the $address variable... And this variable seem not give the correct email

Address in mailbox given [contact@] does not comply with RFC 2822, 3.6.2.'

while the address I test is "[email protected]"

private function _assertValidAddress($address)
    {
        if (!preg_match('/^'.$this->getGrammar()->getDefinition('addr-spec').'$/D',
            $address)) {
            throw new Swift_RfcComplianceException(
                'Address in mailbox given ['.$address.
                '] does not comply with RFC 2822, 3.6.2.'
                );
        }
    }

I tested with php5.6, php7.1 and php 7.2. When php intl is not enabled, there is another error et still not working.

Note that this messages are only displayed when the DEV mode is enabled.. otherwise, I just got a red box without nothing inside :

image

On Front office side,

if I reset the password I got a new symfony report :

Notice: Use of undefined constant INTL_IDNA_VARIANT_UTS46 - assumed 'INTL_IDNA_VARIANT_UTS46'

thank's for your help,

Mike

Additionnal information
PrestaShop version: 1.7.5.0
PHP version: tests with 5.6 - 7.1 - 7.2

Duplicate

Most helpful comment

Hi. Your ICU version is outdated, causing this error in 1.7.5.0 (in prevoius versions INTL_IDNA_VARIANT_UTS46 was not strictly required).
Apply this PR to fix your issue: #11995
From 1.7.5.1 this fix will be included in core.

All 4 comments

Hi. Your ICU version is outdated, causing this error in 1.7.5.0 (in prevoius versions INTL_IDNA_VARIANT_UTS46 was not strictly required).
Apply this PR to fix your issue: #11995
From 1.7.5.1 this fix will be included in core.

Hi @imike57, RFC 2822 is a rule that defines what is a correct email and what is not.

So your 1st error Fatal error: Uncaught exception 'Swift_RfcComplianceException' with message 'Address in mailbox given [contact@] does not comply with RFC 2822, 3.6.2.' seems to indicate you are using an email that is not valid (according to RFC 2822), and this prevents the further processing.

Did you copy the error exactly as it was printed (not edit) ? Because if yes, indeed contact@ is not a valid email.

Thank's guys for your help.

@matks , I confirm, the function got the email value truncated. I fill well "[email protected]" and not "contact@" and it seem got only this...

@rdy4ever has right. Seem related to ICU issue. But I can't update it on the server for now.
Finally I take a copy of the last Mail.php here https://raw.githubusercontent.com/PrestaShop/PrestaShop/develop/classes/Mail.php
And seem working.

Duplicate of #11949

Was this page helpful?
0 / 5 - 0 ratings