- // Headers are usually encoded in the mail plugin that implements
- // \Drupal\Core\Mail\MailInterface::mail(), for example,
- // \Drupal\Core\Mail\Plugin\Mail\PhpMail::mail(). The site name must be
- // encoded here to prevent mail plugins from encoding the email address,
- // which would break the header.
- $headers['From'] = Unicode::mimeHeaderEncode($site_config->get('name'), TRUE) . ' <' . $site_mail . '>';
+ // Make sure the site-name is a RFC-2822 compliant 'display-name'.
+ $headers['From'] = MailHelper::formatDisplayName($site_config->get('name')) . ' <' . $site_mail . '>';