Email::Simple::Creator seems to be putting too many newlines into my emails. I can get the desired behaviour by changing the return value of _crlf() in Creator.pm. It comes from CPAN set to "\x0d\x0a", but it works better for me if it's "\x0a".

I use Perl v5.8.8 and Email::Simple::Creator v1.424. I also use a Qmail as MTA. OS is Linux.


Here is my test code:

#!/usr/bin/perl

use Email::Simple;
use Email::Simple::Creator;
use IO::File;
my $somefh = new IO::File;

$email_obj = Email::Simple->create(
      header => [
         From => "[EMAIL PROTECTED]",
         To => '[EMAIL PROTECTED]',
         Subject => 'This is a subject'
        ],
      body => "This is the body"
      );

open $somefh,"|/var/qmail/bin/qmail-inject";
print $somefh $email_obj->as_string();
close $somefh;

# --------------------------



Here is the result in Mozilla Thunderbird (Windows) when Creator.ph has "\x0d\x0a":

From - Sat Jul 12 19:19:14 2008
X-Account-Key: account2
X-UIDL: 1215861550.14312.ambassador.digitalinscription.com
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
X-Mozilla-Keys: Received: (qmail 14307 invoked by uid 501); 12 Jul 2008 11:19:10 -0000
Message-ID: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: This is a subject

Date: Sat, 12 Jul 2008 19:19:10 +0800




This is the body



Here is the result in Mozilla Thunderbird (Windows) when Creator.pm has "\x0a":

From - Sat Jul 12 19:17:58 2008
X-Account-Key: account2
X-UIDL: 1215861477.14298.ambassador.digitalinscription.com
X-Mozilla-Status: 0001
X-Mozilla-Status2: 00000000
X-Mozilla-Keys: Received: (qmail 14293 invoked by uid 501); 12 Jul 2008 11:17:57 -0000
Message-ID: <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: This is a subject
Date: Sat, 12 Jul 2008 19:17:57 +0800

This is the body


BTW I censored some of the headers above.
I also checked in Outlook Express 6.


--
Rohan Carly

Reply via email to