Subject: | Multipart boundaries |
Date: | Tue, 21 Jun 2011 01:32:24 +0200 |
To: | bug-Courriel [...] rt.cpan.org |
From: | icovnik <icovnik [...] gmail.com> |
Hello,
I found some missing info in email header generated by
Courriel::Builder when creating multipart messages. In "Content-Type"
there is no boundary mentioned, e.g. the $email->as_string produces
something like this:
Subject: x
From: x@y.z
To: x@y.z
Date: Mon, 20 Jun 2011 23:06:18 -0000
Message-Id: <1308611178.6eCAB0.1885@babovka2>
MIME-Version: 1.0
Content-Type: multipart/mixed
--1308611178.D8731.1885
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset=UTF-8
...
but should produce this:
Subject: x
From: x@y.z
To: x@y.z
Date: Mon, 20 Jun 2011 23:06:18 -0000
Message-Id: <1308611178.6eCAB0.1885@babovka2>
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="1308611178.D8731.1885"
--1308611178.D8731.1885
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset=UTF-8
...
If the boundary line is missing my Thunderbird doesn't see any
attachments. If I add it there by hand the attachments are shown.
The test program:
#!/usr/bin/env perl
use Courriel::Builder;
use File::Slurp qw(write_file);
my $e = build_email(
subject("x"),
from('x@y.z'),
to('x@y.z'),
plain_body("b"),
attach(
file => "/bin/dd",
mime_type => "application/octet-stream",
),
);
write_file("email", $e->as_string);
Some info about my system:
- perl 5, version 12, subversion 3 (v5.12.3) built for i686-linux;
built by perlbrew
- Courriel 0.12, installed on 2011-06-20 by cpanm with no problems
- OS: Slackware Linux, kernel 2.6.32.7 32bit, gcc 4.3.3