Jump to content

qmail and bare LFs


Mario F.

Recommended Posts

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.

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.