Skip to content

defaultMailer func, LF used in headers instead of recommended CRLF #584

@Reloecc

Description

@Reloecc

Version: 2.10.8 (and many before)

Bug Description

Php manual says that input to mail function "must obey" RFC2822
https://www.php.net/manual/en/function.mail.php
http://www.faqs.org/rfcs/rfc2822.html

There is stated in this RFC that:
2.2. Header Fields
Header fields are lines composed of a field name, followed by a colon
(":"), followed by a field body, and terminated by CRLF.

Tracy in its defaultMailer replaces everything to just LF.

$parts = str_replace(
["\r\n", "\n"],
["\n", PHP_EOL],

Currently, it has caused some trouble on PHP 8.1.24 - emails are not received as the mail server detects multiple 'from' addresses in one mail header because it can't properly split headers by '\n'. I admit I have not really tested what specifically causes the bug - whether it's some configuration, this particular PHP version, or something else (we tested that PHP 8.2 and 8.3 do not cause this issue). However, I have verified that CRLF works correctly. Since it is described as a 'must obey' rule, I am reporting this as a bug. I can also PR it if we have no reason to persist with LF endings. Opinions?

Steps To Reproduce

Not needed imo and hard to do so, based on server config / php version.

Expected Behavior

obey the rfc

Possible Solution

alter line endings during replacements in defaultMailer function

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions