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 @@ -21,4 +21,11 @@ /** + * A list of headers that can contain multiple email addresses. + * + * @see \Symfony\Component\Mime\Header\Headers::HEADER_CLASS_MAP + */ + private const MAILBOX_LIST_HEADERS = ['from', 'to', 'reply-to', 'cc', 'bcc']; + + /** * The configuration factory. * @@ -78,20 +85,9 @@ } $headers = new Headers(); - // Format the data for Symfony header handlers. - // @see \Symfony\Component\Mime\Header\Headers::HEADER_CLASS_MAP foreach ($message['headers'] as $name => $value) { - switch (strtolower($name)) { - case 'from': - case 'to': - case 'reply-to': - case 'cc': - case 'bcc': - $value = is_array($value) ? $value : [$value]; - break; - - default: - break; + if (in_array(strtolower($name), self::MAILBOX_LIST_HEADERS, TRUE)) { + $value = explode(',', $value); } $headers->addHeader($name, $value); }