in reply to blank lines in email

Dump the bytes of the mail, I'll bet the module is expanding \n to \r\n or something like that. You can use the as_string function instead of send to look at the full MIME message before it is sent.

Completely other idea: could the sendmail on your system be configured oddly? Or is it being called with different switches than -t from Email::Stuff?

HTH,
SSF

Replies are listed 'Best First'.
Re^2: blank lines in email
by jason_s (Acolyte) on Jan 18, 2010 at 22:24 UTC
    Thanks for the tip. I used as_string, and it shows that the module is indeed expanding the \n to \r\n.

    I'm using postfix as my MTA. It sounds like postfix on a Unix system will blindly change any \n to \r\n, trying to helpfully give you the right CRLF line terminator...The extra carriage return is what's causing my problem.

    According to the exim documentation, exim's MTA handles this more intelligently, which is probably why gmargo couldn't duplicate this.

    This SEEMS to me like a bug in Email::Stuff or one of its dependencies. My understanding is that the Unix convention is for the MUA to use the local line terminator (a bare newline), and that the MTA is responsible for massaging this correctly for internet delivery...

      Can you please post exactly what Linux distribution and version you are using? And versions of the relevant modules? I'll see if I can duplicate your setup in a virtual machine.

        Ubunutu 9.04 Jaunty

        Email-Date-Format-1.002
        Email-MIME-1.903
        Email-MIME-Encodings-1.313
        Email-Simple-2.100
        Email-Stuff-2.101

        I also observe the same behavior on a SLES10 machine with the same modules and versions.

        On another SLES10 machine with older modules, I don't see this behavior, i.e., when I use as_string, the lines are terminated by \n, not \r\n. The versions on that machine are:

        Email-Date-Format-1.002
        Email-MIME-1.863
        Email-MIME-Encodings-1.313
        Email-Simple-2.005
        Email-Stuff-2.09
      I tried the same test using Email::Sender::Simple and MIME::Lite. Both of those modules did the right thing. I guess I'll just switch to using one of them.