magento-2-smtp icon indicating copy to clipboard operation
magento-2-smtp copied to clipboard

UTF-8 issue - Invalid header value detected

Open Nuranto opened this issue 3 years ago • 3 comments

Preconditions (*)

Reproduced on Magento 2.4.3-p1 and SMTP 4.6.1 Also reproduced on Magento 2.4.2-p1 and SMTP 4.5.2

Steps to reproduce (*)

  1. Enable Mageplaza_Smtp (It works fine when Mageplaza_Smtp is disabled)
  2. Create a customer with a 'é' in firstname (It works fine without special chars)
  3. On customer backend page, click on reset password

Expected result (*)

  1. Email is sent to customer

Actual result (*)

  1. Error Invalid header value detected
[2021-10-14 15:48:40] main.CRITICAL: Exception message: Invalid header value detected
Trace: <pre>#1 Laminas\Mail\Header\AbstractAddressList->getFieldValue() called at [vendor/laminas/laminas-mail/src/Header/AbstractAddressList.php:212]
#2 Laminas\Mail\Header\AbstractAddressList->toString() called at [vendor/laminas/laminas-mail/src/Headers.php:490]
#3 Laminas\Mail\Headers->toString() called at [vendor/laminas/laminas-mail/src/Message.php:549]
#4 Laminas\Mail\Message->toString() called at [vendor/mageplaza/module-email-attachments/Mail/EmailMessage.php:245]
#5 Mageplaza\EmailAttachments\Mail\EmailMessage->toString() called at [vendor/mageplaza/module-email-attachments/Mail/EmailMessage.php:237]
#6 Mageplaza\EmailAttachments\Mail\EmailMessage->getRawMessage() called at [vendor/mageplaza/module-smtp/Mail/Transport.php:115]
#7 Mageplaza\Smtp\Mail\Transport->aroundSendMessage() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#8 Mageplaza\EmailAttachments\Mail\Transport\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/dotmailer/dotmailer-magento2-extension/Plugin/TransportPlugin.php:97]
#9 Dotdigitalgroup\Email\Plugin\TransportPlugin->aroundSendMessage() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#10 Mageplaza\EmailAttachments\Mail\Transport\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-email/Model/Mail/TransportInterfacePlugin.php:48]
#11 Magento\Email\Model\Mail\TransportInterfacePlugin->aroundSendMessage() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#12 Mageplaza\EmailAttachments\Mail\Transport\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#13 Mageplaza\EmailAttachments\Mail\Transport\Interceptor->___callPlugins() called at [generated/code/Mageplaza/EmailAttachments/Mail/Transport/Interceptor.php:23]
#14 Mageplaza\EmailAttachments\Mail\Transport\Interceptor->sendMessage() called at [vendor/magento/module-customer/Model/EmailNotification.php:277]

(log from M2.4.2-p1 / SMTP 4.5.2)

Nuranto avatar Oct 14 '21 16:10 Nuranto

Hi, I will reproduce and test your problem on the local page. When the test is complete, I will notify you of the results

Thank you!

HuyPhuc98 avatar Oct 15 '21 10:10 HuyPhuc98

Hello,

Were you able to reproduce the issue ?

Nuranto avatar Nov 16 '21 09:11 Nuranto

I had this error on a customer account without special characters and it turned out I somehow pasted a special character into the SMTP credentials config in the admin. If you see this error on an account without a special character double check SMTP details.

DomPixie avatar Jun 14 '22 09:06 DomPixie