1

In admin/config/people/accounts, the body of Welcome e-mail is (my site in in French):

user:display-name],

Un administrateur sur [site:name] a créé un compte pour vous. Vous pouvez maintenant vous connecter en utilisant le lien ci-dessous ou en le copiant dans votre navigateur : 

[user:one-time-login-url]

Ce lien ne peut être utilisé qu'une seule fois pour vous connecter et vous redirigera vers la page où vous pourrez choisir votre mot de passe.

Après avoir choisi votre mot de passe, vous pourrez vous connecter sur [site:login-url] en utilisant : 

nom d'utilisateur : [user:name]
mot de passe : Votre mot de passe

--  L'équipe de [site:name]

And in the e-mail received by the recipent, every apostrophe is changed to ' like in the signature:

--  L'équipe de Le Jardin de Poissy

My version of Drupal is 8.7.8 and I use these modules: Mail System and Swift Mailer.

How can I let Drupal send properly formatted mails including apostrophes?

  • Is your e-mail in plain text or html? – Menno van den Heuvel Oct 23 '19 at 14:04
  • According to the recipient email client application (Mail on MacOS), it is plain text: Content-Type : ⁨text/plain; charset=UTF-8; format=flowed; delsp=yes⁩ – gbmapo Oct 23 '19 at 14:25
  • In the Mail System config, what plugin is selected for Formatter? SwiftMailer or the Default PHP Mailer? – Menno van den Heuvel Oct 24 '19 at 8:30
  • Never mind; I was able to reproduce this problem. – Menno van den Heuvel Oct 24 '19 at 9:02
  • In Mail System settings, I have SwiftMailer for both Formatting and Sending. – gbmapo Oct 24 '19 at 12:13
1

The easiest way to fix this is simply set the formatter to the Default PHP Mailer, if you want to stick to plain text mail.

This is a known bug in the SwiftMailer module where Html::escape is called, even for plain text. Bug report here: https://www.drupal.org/project/swiftmailer/issues/2937293 .

The Html::escape function declares:

  /*
   * This method escapes HTML for sanitization purposes by replacing the
   * following special characters with their HTML entity equivalents:
   * - & (ampersand) becomes &
   * - " (double quote) becomes "
   * - ' (single quote) becomes '
   * - < (less than) becomes &lt;
   * - > (greater than) becomes &gt;
   */

And that's where your &#039; comes from.

  • I made it work adding a Module-specific configuration in Mail System settings: Module=User, Key=All, Formatter plugin=Collecteurs de courriels (e-mails collector, maybe), Sender=by default. – gbmapo Oct 24 '19 at 12:17
  • Glad you got it working! – Menno van den Heuvel Oct 24 '19 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.