You are here: Re: mail() - message lines <= 70 chars « PHP Programming Language « IT news, forums, messages
Re: mail() - message lines <= 70 chars

Posted by Matthew on 11/24/07 13:34

John Dunlop emailed this:
> C. (http://symcbean.blogspot.com/):
>
>> No - that's SMTP which is a specific transport mechanism for email
>> (actually its a whole family of protocols but lets not go there) its
>> up to the MUA ('mail' command on Unix or the SMTP implementation
>> within PHP for |MSWin) to **convert** the message to a suitable format
>> for the MTA, which may in turn encode the message in a different
>> format depending on the carrier protocol.
>
> Right.
>
>> Perhaps historically the SMTP implementation in PHP couldn't
>> accomodate this.
>>
>> If you sniff the SMTP connection you'll see that long lines do get
>> wrapped - but the original message is restored when it comes out the
>> MUA at the other end.
>
> I wonder where PHP's figure 70 came from? If long lines do get
> wrapped but you still recommended a limit, would you not recommend
> 78, in line with the transfer protocol?
>
> On the other note, line endings seem a bit messy: \n for the message
> body but \r\n for headers, whereas the transfer protocol demands \r\n
> across the board. Then, I suppose, the whole business of line ending
> conventions is messy.

It seems a strange for PHP to place an extra limitation like this on line
lengths. It's not really a problem as line wrapping at 70 chars looks
perfectly neat in all email clients I've ever used. As it happens between
70 and 75 chars are the settings I've always used when manually setting
word wrap in my email client's options.

My question was why PHP places this restriction at all. It's not even
sending the mail itself anyway, just passing the email to 'sendmail',
surely then it should simply be concerned with whatever line length
restrictions 'sendmail' imposes.

I've just looked in the sendmail manual which says it conforms to RFC 821,
this is the SMTP standard, URL - http://www.ietf.org/rfc/rfc0821.txt

The relevant bit of the RFC 821 SMTP standard says:

"Text Line - The maximum total length of a text line including the <CRLF>
is 1000 characters (but not counting the leading dot duplicated for
transparency)."

AFAICT SMTP does not place any further restrictions on message body line
lengths (though other fields do have text length restrictions such as the
reply line being a max. of 512 chars). I can't find any reference in the
protocol to message body lines (or any other lines) being further limited
to either 70 or 78 characters.

With that said, why is PHP concerned with further limits? Why not just let
the user enter their own newlines, the programmer add a CRLF at 998 chars
if necessary, and let the recipient's email client handle line wrapping as
per it's own settings/user options?

Any comments?

Regards, etc..

Matthew

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация