Re: text email & new line
| From: | Jordi Canals | Date: | Tue, 02 Nov 2004 17:34:00 +0000 |
| Subject: | Re: text email & new line | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-200932@lists.php.net to get a copy of this message | ||
On Tue, 2 Nov 2004 16:25:56 +0000, Richard Davey <rich@launchcode.co.uk> wrote:
> Hello Jerry,
>
> JS> I'm sending text email. How I can make new line.
> JS> "\n" seems to be not working.
>
> \n in a text (not HTML) email will do the trick most of the time,
> sometimes I see \r\n, but \n works for me nicely. Are you sure it's
> quoted properly? "" instead of ''?
>
The RFC 2822 for Internet Message Format states clearly that MUST be
"\r\n" using only "\n" is not standard and you cannot expet all
servers to accept it as a valid separator.
Just want to take your attention to this paragraph from RFC 2822:
"Messages are divided into lines of characters. A line is a series of
characters that is delimited with the TWO characters carriage-return
and line-feed; that is, the carriage-return (CR) character (ASCII
value 13) followed inmediatly by the line-feed (LF) character (ASCII
value 10)."
Also take in consideration that a message line cannot have more that
998 characters (plus CRLF) ...
The RFC 2821 says: "The apperance of "CR" or "LF" characters in text
has long history of causing problems in mail implementations and
applications that use the mail system as a tool. SMTP client
implementattions MUST NOT transmit these characters except when they
are intended as line terminators and then MUST transmit them only as
<CRLF> sequence."
I hope this will help in composing mail messages and my recommendation
is to *follow the standard* and send messages always by using CRLF as
a line delimiter. Only doing that way, you will ensure your messages
are accepted by any server.
More information:
RFC 2822 - http://www.faqs.org/rfcs/rfc2822.html.
RFC 2821 - http://www.faqs.org/rfcs/rfc2821.html.
Best regards,
Jordi.