I've seen a lot of examples using the php mail function. Some of them use \r\n as line break for the header, some use \n.
$headers = "From: Just Me\n"; $headers .= "Reply-To: Just me <$email>\n";
vs
$headers = "From: Just Me\r\n"; $headers .= "Reply-To: Just me <$email>\r\n";
which one is correct?
Sometimes I've had cases where \r\n is used and part of the header is interpreted by some email clients as mail text (losing these header information) - is this because \r\n is wrong?
1. %0d%0a is the new line symbol of the email body in a mailto link. Please enter the %0d%0a symbol next to the original body text in the Subject box, and then type the new line content after the symbol.
\n is the newline or linefeed, other side \r is the carriage return.
In the most basic way you can Just press Ctrl + Enter when typing out the email, e.g. If you are needing something more complex, then you can Generate the email using a hidden HtmlText Box. If you are comfortable with HTML. You can then add a <br/> tag to allow a new line.
The CRLF \r\n
, 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, CR \r
immediately followed by the line feed, LF \n
.
Since \r\n
is native to Windows platforms and \n
to Unix, you can use the PHP_EOL
Docs constant on Windows, which is the appropriate new line character for the platform the script is currently running on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With