Skip to content
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

Merged
merged 2 commits into from Sep 3, 2021
Merged

Use crlf in mail headers #15807

merged 2 commits into from Sep 3, 2021

Conversation

markstory
Copy link
Member

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

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
@markstory markstory added the email label Sep 1, 2021
@markstory markstory added this to the 4.2.9 milestone Sep 1, 2021
@@ -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");
Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member Author

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.

@othercorey othercorey changed the base branch from master to 4.x September 3, 2021 13:36
@markstory markstory merged commit 48735ff into 4.x Sep 3, 2021
@markstory markstory deleted the fix-15803 branch September 3, 2021 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants