Skip to content

Commit

Permalink
Merge pull request #25 from Z-Hub/24-error-sending-mail-corrupt-headers
Browse files Browse the repository at this point in the history
PHP8.0 mail() to use /r/n line endings
  • Loading branch information
matidau committed Aug 27, 2023
2 parents 7b3432f + 2f0b2c8 commit 339fe67
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/backend/imap/Mail/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ public function __construct($params = null)
/* Because the mail() function may pass headers as command
* line arguments, we can't guarantee the use of the standard
* "\r\n" separator. Instead, we use the system's native line
* separator. */
if (defined('PHP_EOL')) {
* separator.
* Fixed in PHP 8.0.
*/
if (defined('PHP_EOL') && version_compare(PHP_VERSION, '8.0.0', '<')) {
$this->sep = PHP_EOL;
} else {
} elseif (version_compare(PHP_VERSION, '8.0.0', '<')) {
$this->sep = (strpos(PHP_OS, 'WIN') === false) ? "\n" : "\r\n";
}
}
Expand Down

0 comments on commit 339fe67

Please sign in to comment.