Hi! I've begun using Email::Stuff in my scripts lately. I'm having a problem, where it's putting extra blank lines after newlines. I don't see this behavior when sending directly through sendmail. Here's my test program:
#!/usr/bin/perl use warnings; use strict; use Email::Stuff; my $body="line1\nline2\n"; my $to='jason@example.com'; #use email::stuff Email::Stuff->to($to) ->subject("hello from Email::Stuff") ->text_body($body) ->send; #use sendmail open ( MAILER, "|/usr/lib/sendmail -t" ); print MAILER "To: $to\n"; print MAILER "Subject: hello from sendmail\n"; print MAILER "$body"; close MAILER;
When I run it, I get two mails (headers scrubbed): The mail sent using Mail::Stuff has a blank line in it:
Return-Path: <jason@evo.u.lg.########.com>
Received: from evo (##.###.126.68)
	by mailx.########.com (Kerio MailServer 6.7.1)
	for jason@########.com;
	Fri, 15 Jan 2010 15:12:39 -0800
Received: by evo (Postfix, from userid 516)
	id CD5CE2DBBBA; Fri, 15 Jan 2010 15:12:38 -0800 (PST)
Date: Fri, 15 Jan 2010 15:12:38 -0800
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Transfer-Encoding: quoted-printable
To: jason@########.com
Subject: hello from Email::Stuff
Message-Id: <20100115231238.CD5CE2DBBBA@evo>
From: jason@evo.u.lg.########.com (Jason Speck)

line1

line2
The mail sent via sendmail does not have a blank line in it.
Return-Path: <jason@evo.u.lg.######.com>
Received: from evo (##.###.126.68)
	by ######.######.com (Kerio MailServer 6.7.1)
	for jason@######.com;
	Fri, 15 Jan 2010 15:12:39 -0800
Received: by evo (Postfix, from userid 516)
	id D9DBC81EACA; Fri, 15 Jan 2010 15:12:38 -0800 (PST)
To: jason@######.com
Subject: test using sendmail
Message-Id: <20100115231238.D9DBC81EACA@evo>
Date: Fri, 15 Jan 2010 15:12:38 -0800 (PST)
From: jason@evo.u.lg.######.com (Jason Speck)

line1
line2
I suspect that Email::Stuff is doing what it's supposed to, but I'm just not understanding something about how mail works. I'd like to understand (1), where the blank lines after newlines are coming from, and (2) how to get rid of them so that I can get the formatting that I want.

In reply to blank lines in email by jason_s

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.