Bug #49076 [Opn->Wfx]: "\n." is incorrectly replaced with "\n.."

From: Date: Tue, 08 Dec 2020 11:17:27 +0000
Subject: Bug #49076 [Opn->Wfx]: "\n." is incorrectly replaced with "\n.."
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230933@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=49076&edit=1

 ID:                 49076
 Updated by:         cmb@php.net
 Reported by:        nestor at sakimori-x dot com
 Summary:            "\n." is incorrectly replaced with "\n.."
-Status:             Open
+Status:             Wont fix
 Type:               Bug
 Package:            Mail related
 Operating System:   win32 only - WinXP SP3
 PHP Version:        5.2.10
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

That is correct.  However, RFC 5321 also states in section
2.3.8[1] that clients must not send stand-alone LF characters.
This is not enforced by PHP's mail() implementation.

Given that mail() allows to send stand-alone LF since "forever",
that this ticket got almost no attention, and that automatically
replacement of LF with CRLF may actually break more working code
than fix it, we should leave this to user code.

[1] <https://tools.ietf.org/html/rfc5321#section-2.3.8>


Previous Comments:
------------------------------------------------------------------------
[2009-07-27 17:37:58] nestor at sakimori-x dot com

Description:
------------
The SMTP spec states (sec. 4.5.2) that all instances of "<CRLF>." (not including the
SMTP message-ending "<CRLF>.<CRLF>" sequence) should be replaced with
"<CRLF>..". It seems PHP is replacing all instances of "<LF>." with
"<LF>..", regardless of the presence of a "<CR>" character.
 
This was originally reported as bug #623 way back in 1998 and is still an issue.

Reproduce code:
---------------
mail($test_address, "test subject", "abc\n.jkl\r\n.xyz\r\nzzz");

Expected result:
----------------
An SMTP message containing "abc\n.jkl\r\n..xyz\r\nzzz" should be sent.

Actual result:
--------------
An SMTP message containing "abc\n..jkl\r\n..xyz\r\nzzz" is sent. This was confirmed with a
packet sniffer (no server logs/reports or mail clients to muddy the waters).


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=49076&edit=1


Thread (2 messages)

« previous php.bugs (#230933) next »