Email not triggering if site name is not in english because of exceeding encoded sender header length

Created on 19 January 2024, about 1 year ago
Updated 22 January 2024, about 1 year ago

We recently upgraded from Drupal 9 to drupal 10. After upgrade we noticed emails are not sending for the site for AR language.

So this is a multilingual site with english and arabic language.

Emails for english are working fine but not working from arabic language.

In logs, we noticed this was because of encoded address maxlength. Currently system (AWS) supports 320 for maxlength but seems like with new symfony mailer, the encoded length is increasing as compared to Drupal9.

Steps to reproduce -

  • Setup a multilingual website with EN and arabic as lanaguage
  • Setup the site name in Arabic for arabic language
  • Try to register or forget password from the arabic language and notice for email

This seems happening because of Drupal MailManager::doMail() for this line -

  if ($site_mail) {
      $mailbox = new MailboxHeader('From', new Address($site_mail, $site_config->get('name') ?: ''));
      $headers['From'] = $mailbox->getBodyAsString();
    }
🐛 Bug report
Status

Active

Version

10.1

Component
Mail 

Last updated 17 days ago

No maintainer
Created by

🇮🇳India joshi.rohit100 Delhi, India

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @joshi.rohit100
  • 🇮🇳India joshi.rohit100 Delhi, India

    for the workaround, could be to implement hook_mail_alter() and replaced the generation of encoded header with D9 implementation in custom module.

  • Assigned to arunkumark
  • Issue was unassigned.
  • 🇮🇳India arunkumark Coimbatore

    joshi.rohit100,
    Verified the same step with the latest Drupal core 10.1.9-dev. It working fine for the Email. Able to receive the Password recovery Email from the Tamil language mail. I followed below steps below,

    1. Installed Language and 3 Translation modules
    2. Added Tamil(TA) as additional language with English.
    3. Updated site name for the Tamil admin/config/system/site-information/translate and admin/config/system/site-information/translate/ta/edit
    4. Updated Account settings at Translations for Account settings Add to Default shortcuts and changed the Password recovery as in Tamil.
    5. Added Tamil as user language in user edit.
    6. Triggered the password recovery for the Tamil language user.
    7. Able to see the Tamil language recovery email

    The issue might be a reason from the Environmental issue.


  • 🇮🇳India nikunjkotecha India, Gujarat, Rajkot

    @arunkumark

    * Please add Tamil characters in Site Name
    * Please try to install both Drupal 9 and Drupal 10 and compare the number of UTF8 characters in FROM address

    Issue is that the number of characters increases drastically (with D9 we had around 79 characters and for the same text in D10 it became 358 characters.

    Number of characters limitation may be environment specific but increase in characters can be reproduced. (you can check the original headers of the mail to observe this)

  • 🇮🇳India arunkumark Coimbatore

    @Nikunj Kotecha

    I have updated the FROM name, but I can still not replicate the issue.

  • 🇮🇳India nikunjkotecha India, Gujarat, Rajkot

    Check the headers tab Arun :)

    Drupal 9 code:
    =?UTF-8?B?2YXZiNmC2Lkg2KfYrtiq2KjYp9ixINiv2LHZiNio2KfZhA==?=

    Drupal 10 code:
    =?utf-8?Q?=3D=3Futf-8=3FQ=3F=3DD9=3D85=3DD9=3D88=3DD9=3D82=3DD8=3D?= =?utf-8?Q?B9=5F=3DD8=3DA7=3DD8=3DAE=3DD8=3DAA=3F=3D?= =?utf-8?Q??= =?utf-8?Q?=D8=A8=D8=A7=D8=B1_=D8=AF=D8=B1=D9=88=D8=A8=D8=A7=D9=84?=

  • 🇮🇳India arunkumark Coimbatore

    @nikunjkotecha
    Thanks for sharing the mail header. I have attached the Mail header I have tested. Please verify this.

Production build 0.71.5 2024