I've seen a lot of examples using the php mail function. Some of them use rn as line break for the header, some use n.
$headers = "From: Just Men";
$headers .= "Reply-To: Just me <$email>n";
vs
$headers = "From: Just Mern";
$headers .= "Reply-To: Just me <$email>rn";
which one is correct?
Sometimes I've had cases where rn is used and part of the header is interpreted by some email clients as mail text (losing these header information) - is this because rn is wrong?
The CRLF
rn
, should be used according to the php documentation. Also, to conform to the RFC 2822 spec lines must be delimited by the carriage return character, CRr
immediately followed by the line feed, LFn
.Since
rn
is native to Windows platforms andn
to Unix, you can use thePHP_EOL
Docs constant on Windows, which is the appropriate new line character for the platform the script is currently running on.