Blanks in message headers

Jason random.numbers at
Sat Jan 7 00:20:39 CET 2006

If you don't set your smtp_server in and you are on *nix
you'll run into problems with extra lines in your sent headers.  Since
roundcube uses the mail() function if you don't set smtp_server in, shouldn't it account for its environment and strip the
"\r" from the sending headers?

>From Ben Cooke on the php page on the mail() function:
"Note that there is a big difference between the behavior of this
function on Windows systems vs. UNIX systems. On Windows it delivers
directly to an SMTP server, while on a UNIX system it uses a local
command to hand off to the system's own MTA.

 The upshot of all this is that on a Windows system your  message and
headers must use the standard line endings \r\n as prescribed by the
email specs. On a UNIX system the MTA's "sendmail" interface assumes
that recieved data will use UNIX line endings and will turn any \n to
\r\n, so you must supply only \n to mail() on a UNIX system to avoid
the MTA hypercorrecting to \r\r\n.

 If you use plain old \n on a Windows system, some MTAs will get a
little upset. qmail in particular will refuse outright to accept any
message that has a lonely \n without an accompanying \r."


More information about the Dev mailing list