Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
There is a bug which breaks From mail header field.
It is fixed by this patch.
core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php
Line 65 to 67
Before
<?php
foreach ($message['headers'] as $name => $value) {
$mimeheaders[] = $name . ': ' . Unicode::mimeHeaderEncode($value);
}
?>
After
<?php
foreach ($message['headers'] as $name => $value) {
if (strcasecmp($name, 'From') == 0) {
$sender_part = array();
if (!preg_match('/^(.+) <(.+?)>$/', $value, $sender_part)) {
$mimeheaders[] = $name . ': ' . Unicode::mimeHeaderEncode($value);
continue;
}
$sender_name = $sender_part[1];
$sender_addr = $sender_part[2];
$mimeheaders[] = $name . ': ' . Unicode::mimeHeaderEncode($sender_name) .
' <' . $sender_addr . '>';
} else {
$mimeheaders[] = $name . ': ' . Unicode::mimeHeaderEncode($value);
}
}
?>
Comments
Comment #2
mh35 CreditAttribution: mh35 commentedComment #3
Liam MorlandDuplicate of #2717965: Site name is not UTF-8 encoded in email headers.