diff -u b/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php b/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php --- b/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php +++ b/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php @@ -6,6 +6,7 @@ use Drupal\Core\Mail\MailInterface; use Drupal\Core\Site\Settings; use Symfony\Component\Mime\Header\Headers; +use Symfony\Component\Mime\Header\UnstructuredHeader; /** * Defines the default Drupal mail backend, using PHP's native mail() function. @@ -76,11 +77,12 @@ } } $headers = new Headers(); - $headers->addTextHeader('subject', $message['subject']); foreach ($message['headers'] as $name => $value) { $headers->addHeader($name, $value); } $line_endings = Settings::get('mail_line_endings', PHP_EOL); + // Prepare mail commands. + $mail_subject = (new UnstructuredHeader('subject', $message['subject']))->getBodyAsString(); // Note: email uses CRLF for line-endings. PHP's API requires LF // on Unix and CRLF on Windows. Drupal automatically guesses the // line-ending format appropriate for your system. If you need to @@ -105,7 +107,7 @@ $additional_headers = isset($message['Return-Path']) && ($site_mail === $message['Return-Path'] || static::_isShellSafe($message['Return-Path'])) ? '-f' . $message['Return-Path'] : ''; $mail_result = @mail( $message['to'], - $headers->get('subject')->toString(), + $mail_subject, $mail_body, $mail_headers, $additional_headers @@ -118,7 +120,7 @@ ini_set('sendmail_from', $message['Return-Path']); $mail_result = @mail( $message['to'], - $headers->get('subject')->toString(), + $mail_subject, $mail_body, $mail_headers ); only in patch2: unchanged: --- a/core/misc/cspell/dictionary.txt +++ b/core/misc/cspell/dictionary.txt @@ -933,7 +933,6 @@ middlewares midgardmvc mikey milli -mimeheaders mimetypes minifyzombies minimatch