I see a lot of PHP email implementations using “\r\n”, but I have also seen some of them using the PHP_EOL constant. Which one is better?
Thanks for any help
Metropolis
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If this is to terminate lines in an email then it’s the spec for email that you need to look at, not what is used on any particular platform.
Lines in email are terminated by CRLF (“\r\n”) according to RFC2821
That seems pretty clear that in an email the end of line is to be sent as \r\n . Sending anything else might work but it’s wrong unless you are using a “service extension” and if you are then you probably know what you should be sending anyway.