Issue #3319062 by arx-e, poker10, rclemings, down2under, mcdruid, aitala, longwave, edvanleeuwen, jbiechele, davidwhthomas, danrod, stevewilson, Chase.: [D7] PhpMail : broken mail headers in PHP 8.0+ because of LF characters
parent
81842bc61b
commit
0e0a091582
|
@ -62,7 +62,14 @@ class DefaultMailSystem implements MailSystemInterface {
|
|||
$mail_body = preg_replace('@\r?\n@', $line_endings, $message['body']);
|
||||
// For headers, PHP's API suggests that we use CRLF normally,
|
||||
// but some MTAs incorrectly replace LF with CRLF. See #234403.
|
||||
$mail_headers = join("\n", $mimeheaders);
|
||||
$headers_line_endings = variable_get('mail_headers_line_endings', "\n");
|
||||
if (defined('PHP_VERSION_ID') && PHP_VERSION_ID >= 80000 ) {
|
||||
// PHP 8+ requires headers to be separated by CRLF, see:
|
||||
// - https://bugs.php.net/bug.php?id=81158
|
||||
// - https://github.com/php/php-src/commit/6983ae751cd301886c966b84367fc7aaa1273b2d#diff-c6922cd89f6f75912eb377833ca1eddb7dd41de088be821024b8a0e340fed3df
|
||||
$headers_line_endings = variable_get('mail_headers_line_endings', "\r\n");
|
||||
}
|
||||
$mail_headers = join($headers_line_endings, $mimeheaders);
|
||||
|
||||
// We suppress warnings and notices from mail() because of issues on some
|
||||
// hosts. The return value of this method will still indicate whether mail
|
||||
|
|
Loading…
Reference in New Issue