Re[4]: [PHP] text email new line

2004-11-03 Thread Richard Davey
Hello Jason,

Wednesday, November 3, 2004, 11:50:26 AM, you wrote:

JW If you're interested:
JW http://homepages.tesco.net/~J.deBoynePollard/FGA/qmail-myths-dispelled.html
JW the section entitled The myth about supporting bare LFs being a requirement

Interesting reading. Pair Networks use qmail as their SMTP server of
choice so I threw a test email out via PHP that had \n's all over the
shop and it arrived quite happily. So either something has changed
since the writing of that or it's perhaps optional and set by the host
themselves?

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I am not young enough to know everything. - Oscar Wilde

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Re[4]: [PHP] text email new line

2004-11-03 Thread Jason Wong
On Wednesday 03 November 2004 12:29, Richard Davey wrote:

 Interesting reading. Pair Networks use qmail as their SMTP server of
 choice so I threw a test email out via PHP that had \n's all over the
 shop and it arrived quite happily. So either something has changed
 since the writing of that or it's perhaps optional and set by the host
 themselves?

qmail has a patch that handles bare linefeeds.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Nobody can be as agreeable as an uninvited guest.
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] text email new line

2004-11-02 Thread Jerry Swanson
I'm sending text email. How I can make new line. 
\n seems to be not working.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] text email new line

2004-11-02 Thread Greg Donald
On Tue, 2 Nov 2004 11:12:49 -0500, Jerry Swanson [EMAIL PROTECTED] wrote:
 I'm sending text email. How I can make new line.
 \n seems to be not working.

Use \r\n instead of just \n.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] text email new line

2004-11-02 Thread Richard Davey
Hello Jerry,

Tuesday, November 2, 2004, 4:12:49 PM, you wrote:

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 ''?

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I am not young enough to know everything. - Oscar Wilde

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] text email new line

2004-11-02 Thread Sebastiano Cascione
Use \r\n 
Some pop server doesn't support other special characters.

Sebastiano

Alle 17:12, martedì 2 novembre 2004, Jerry Swanson ha scritto:
 I'm sending text email. How I can make new line.
 \n seems to be not working.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] text email new line

2004-11-02 Thread Jordi Canals
On Tue, 2 Nov 2004 16:25:56 +, Richard Davey [EMAIL PROTECTED] 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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] text email new line

2004-11-02 Thread Jerry Swanson
#1. $headers .= Content-Type: text/plain;
#2. $headers .= Content-Type: text/html; charset=iso-8859-1\r\n;

If I use #1 header I don't need \n\r just create extra space on the email.

Why \n\r doesn't work for #2 ?

TH



On Tue, 2 Nov 2004 17:23:41 +0100, Sebastiano Cascione
[EMAIL PROTECTED] wrote:
 Use \r\n
 Some pop server doesn't support other special characters.
 
 Sebastiano
 
 Alle 17:12, martedì 2 novembre 2004, Jerry Swanson ha scritto:
 
 
  I'm sending text email. How I can make new line.
  \n seems to be not working.
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] text email new line

2004-11-02 Thread Jerry Swanson
It is working without \r\n.  Just using regular spaces/new lines in
the text message.


On Tue, 2 Nov 2004 18:34:00 +0100, Jordi Canals [EMAIL PROTECTED] wrote:
 On Tue, 2 Nov 2004 16:25:56 +, Richard Davey [EMAIL PROTECTED] 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.
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] text email new line

2004-11-02 Thread Richard Davey
Hello Jordi,

Tuesday, November 2, 2004, 5:34:00 PM, you wrote:

JC I hope this will help in composing mail messages and my recommendation
JC is to *follow the standard* and send messages always by using CRLF as
JC a line delimiter. Only doing that way, you will ensure your messages
JC are accepted by any server.

I'm not disagreeing with what you posted, because it's all true, but I
would like to ask - can you actually name a popular mail server that
rejects emails that use \n as a line delimiter (even if used by
mistake), because I've haven't seen it happen for years.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I am not young enough to know everything. - Oscar Wilde

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Re[2]: [PHP] text email new line

2004-11-02 Thread Jordi Canals
Hi Richard,

On Wed, 3 Nov 2004 00:19:59 +, Richard Davey [EMAIL PROTECTED] wrote:
 Hello Jordi,
 
 Tuesday, November 2, 2004, 5:34:00 PM, you wrote:
 
 JC I hope this will help in composing mail messages and my recommendation
 JC is to *follow the standard* and send messages always by using CRLF as
 JC a line delimiter. Only doing that way, you will ensure your messages
 JC are accepted by any server.
 
 I'm not disagreeing with what you posted, because it's all true, but I
 would like to ask - can you actually name a popular mail server that
 rejects emails that use \n as a line delimiter (even if used by
 mistake), because I've haven't seen it happen for years.
 

Well, I don't know if this has changed, but less than one year ago
Hotmail was one of them and dropped mail messages with LF as line
separator. Some SMTP implementations on Windows also drops the
messages. And, finally some clients don't wrap the message correctly
when received and you have to scroll horizontally to read long lines.

Take in attention the 2.3.7 section of the RFC 2821 wich says: SMTP
client implementations MUST NOT transmit these characters (CR or LF)
except when they are intended as line terminators and then MUST,
transmit them only as a CRLF sequence.

So, when we are sending a message from PHP, we are involved in an SMTP
client implementation. Then, when composing the headers or the body
for a message to be sent (i.e. using the mail() function) we have to
follow the standards to ensure that the message will not be rejected
by any server just because we sent it in a bad format.

So, because we cannot ensure that all SMTP servers in the world will
accept non-standard line terminators, my recommendation when sending
mail, is to use the standard line terminator and compose headers and
body with CRLF as a line terminator. Only that way you will be
absolutelly sure that the mail will not be rejected because of line
terminators.

I think a good way to do it, is to define a CRLF constant:

define('CRLF', \r\n);

You could also ensure that the body is well formed forcing the line
terminators to CRLF:

$body = preg_replace(/(\r\n)|(\r)|(\n)/, \r\n, $body);

Best regards,
Jordi.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Re[2]: [PHP] text email new line

2004-11-02 Thread Jason Wong
On Wednesday 03 November 2004 00:19, Richard Davey wrote:

 I'm not disagreeing with what you posted, because it's all true, but I
 would like to ask - can you actually name a popular mail server that
 rejects emails that use \n as a line delimiter (even if used by
 mistake), because I've haven't seen it happen for years.

If you're interested:

http://homepages.tesco.net/~J.deBoynePollard/FGA/qmail-myths-dispelled.html

the section entitled The myth about supporting bare LFs being a requirement

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
History allows us to see the obvious -- but unfortunately,
not until it is too late.

  -- PRINCE RAPHAEL CORRINO
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php