Updated send_mail to be compatible with php 8.x

This commit is contained in:
Hani Rouatbi
2022-12-03 11:05:53 +01:00
committed by GitHub
parent e3684c2f6d
commit 2c23cf4ced

View File

@@ -250,11 +250,7 @@ function send_mail($to, $body, $subject, $fromAddress, $fromName, $bcc = '')
$body = str_replace(["\n", "\0"], ["\r\n", ''], $body);
// Change the line breaks used in the headers according to OS
if (strtoupper(substr(PHP_OS, 0, 3)) == 'MAC')
{
$headers = str_replace("\r\n", "\r", $headers);
}
elseif (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN')
if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN' && version_compare(PHP_VERSION, '8.0.0', '<'))
{
$headers = str_replace("\r\n", "\n", $headers);
}