Mario F. Posted February 29, 2008 Share Posted February 29, 2008 Hello all, I'm trying to send the results of a form processing operation through email. I'm doing this on a Windows machine with WAMP and using Mobile TCP as smtp forwarding mechanism to point to my ISP smtp server. The finished message is formated as such: $body = "Message received from the automated contact form at www.mzproperty.co.uk\n"; $body .= "DO NOT REPLY TO THIS MESSAGE\n"; /*...*/ $body .= "-----------------------------\n"; $body .= "END OF MESSAGE\n"; On my web host this formatting works fine. It also follows what I am learning from the PHP manual. But when ran from my machine, it is refused by my ISP's MTA (qmail) with a "server response: 451" pointing me to the fact I'm using bare LFs on my message. When changing the LFs to CRLF the message gets successfully through. So... this confused me. What exactly is the right way to do it? qmail directs me to RFC 2822 section 2.3, which does state indeed I should use CRLF; The PHP Manual instructs me in the use of LF only; and my web host doesn't care as both forms get through. Quote Link to comment https://forums.phpfreaks.com/topic/93759-qmail-and-bare-lfs/ Share on other sites More sharing options...
hawkenterprises Posted February 29, 2008 Share Posted February 29, 2008 Well when using any type of network protocol in raw mode, CRLF is the way to go. Also another note RFCs are generally the best bet when it comes to network protocol. Most languages tend to screw up the protocol and have goofy ways to do it. CRLF \r\n. Part of the reason you do a CRLF instead of a LF is because of legacy support. \n or Line Feed is relatively new and not supported by old machines where CR is and vice versa for modern systems so when in doubt use both Quote Link to comment https://forums.phpfreaks.com/topic/93759-qmail-and-bare-lfs/#findComment-480438 Share on other sites More sharing options...
Mario F. Posted February 29, 2008 Author Share Posted February 29, 2008 Thanks hawk. This is probably an effect of using PHP on a windows machine, since my message needs to be parsed by an MTA which is more restricting on what I can do. However I do wonder why is that on all other places, the mail() function obeys 822bis, except on the body for both windows and unix implementations. Anyway, thanks once again. I will use CRLF throughout. Quote Link to comment https://forums.phpfreaks.com/topic/93759-qmail-and-bare-lfs/#findComment-480476 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.