Re: mail() and \r\n

From: Date: Tue, 14 Mar 2000 05:17:27 +0000
Subject: Re: mail() and \r\n
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-16778@lists.php.net to get a copy of this message
According to RFC 821 (SMTP), ~ line 3795, the other person appears to be correct... line: A a sequence of ASCII characters ending with a <CRLF>. <CRLF>: The characters carriage return and line feed (in that order). But I have never seen any problems with simply using \n (LF), and am not sure what would happen if we moved to <CRLF>... I looked around for a bit to see if I could find anything that might answer this question, and found the following in man sendmail: -ba Go into ARPANET mode. All input lines must end with a CR-LF, and all messages will be generated with a CR-LF at the end. Also, the `From:'' and `Sender:'' fields are examined for the name of the sender. So, sendmail seems to accept \n as a valid "end of line" character, which is not all that surprising. Since sendmail claims: >Sendmail is based on RFC821 (Simple Mail Transport Protocol), RFC822 >(Internet Mail Format Protocol), RFC1123 (Internet Host Requirements), >RFC1521 (MIME), RFC1651 (SMTP Service >Extensions), RFC1891 (SMTP Delivery Status Notifications), RFC1892 >(Multipart/Report), RFC1893 (Mail System Status Codes), RFC1894 (Delivery >Status Notifications), and RFC1985 (SMTP >Service Extension for Remote Message Queue Starting). However, since >sendmail is designed to work in a wider world, in many cases it can be >configured to exceed these protocols. These cases are >described herein. > (Quote from http://www.sendmail.org/~ca/email/doc8.8/op.html) I'm thinking this might be a good place to plug in a .ini switch, whether to be RFC-821 compliant or not, default 0. For those in doubt, I found the RFC at: http://www.cis.ohio-state.edu/htbin/rfc/rfc821.html Start looking at line 1738 to see the list of valid SMTP commands. They are all terminated by <CRLF. --Joey Smith On Mon, 13 Mar 2000, Björn Schotte wrote: > Hi, > > I recently had a flame-like discussion about the mail() > function in a mailing list. One guy says that > > mail($to,"blubb",$somemessage,"From: xyz <xyz@bla.de>\r\n"); > > would be more standard (in the sense of those RfCs) than a > > mail($to,"blubb",$somemessage,"From: xyz <xyz@bla.de>\n"); > > My argumentation was that mail() doesn't make a dialog > with the SMTP server itself (with HELO, MAIL FROM etc.) > but only opens a connection to the MTA that is configured > in the php3.ini (like sendmail, or qmail-inject etc.) > > Additionally, I browsed through mail.c in the PHP3 > source code and saw that mail.c also only uses "\n" > when pumping the data to sendmail. > > Who is right? me or the guy? > -- > Björn Schotte Fon: 0931 / 78 43 79 2 > <http://www.php-center.de/> Fax: 0931 / 78 43 79 > 5 > <http://www.web-cards.de/> > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.dev (#16778) next »