Fixed email header bug which would become a major issue with PHP8
This commit is contained in:
@@ -122,6 +122,18 @@ class Emailnotification {
|
||||
//$log->debug(print_r($headers, true));
|
||||
|
||||
$mail =& Mail::factory('mail', ["-f ".$this->email_from]);
|
||||
/*
|
||||
* PHP 8's mail() function now outputs proper line endings in headers (CRLF instead of LF).
|
||||
* Mail_mail < 2.0 would detect a unix system and change the headers line ending to LF.
|
||||
* On Mail submission to Exim (via sendmail), mail() adds its own headers first with CRLF line ending,
|
||||
* making Exim treat every subsequent header's LF as an invalid line ending, adding a whitespace after the LF,
|
||||
* making all our custom headers into one long header.
|
||||
*
|
||||
* See: https://www.exim.org/exim-html-current/doc/html/spec_html/ch-message_processing.html#SECTlineendings
|
||||
*
|
||||
* So we force CRLF line endings for headers here.
|
||||
*/
|
||||
$mail->sep = "\r\n";
|
||||
$mail->send($this->email_to, $headers, $body);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user