New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use crlf in mail headers #15807
Use crlf in mail headers #15807
Conversation
Separate mail headers with \r\n to be compliant with RFC specs. This also fixes delivery issues in PHP 8. The content is also wrapped with CRLF for consistency. Testing this with a variety mail transfer agents is not something I'm able to do at this time. Refs #15803
@@ -41,7 +41,7 @@ public function send(Message $message): array | |||
$to = $message->getHeaders(['to'])['To']; | |||
$to = str_replace("\r\n", '', $to); | |||
|
|||
$eol = $this->getConfig('eol', PHP_EOL); | |||
$eol = $this->getConfig('eol', "\r\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The php bug listed above was fixed in php8. https://bugs.php.net/bug.php?id=47983
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm hoping that MTAs are ok with CRLF in headers. The other option would be to change the default based on the PHP version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the standard and if php 8 is doing it then we're as compatible as php is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if php 7.4 will throw errors because PHP uses \n
while cakephp uses \r\n
. We might need version-specific default?
Would be nice to test that at least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, using \n
for PHP7 would make this a safer change.
Separate mail headers with \r\n to be compliant with RFC specs. This also fixes delivery issues in PHP 8. The content is also wrapped with CRLF for consistency. Testing this with a variety mail transfer agents is not something I'm able to do at this time.
Refs #15803