Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top