Hello,
I couldn't find a way of using Email::MIME::Kit to compose a message by
adding the file attachments on the fly that allow adding more or less files
for different recipients, so I am trying to use Email::MIME for this.
But I found that Email::MIME brokes the pdf file attachments by increasing
their size.
I use the code below as an example of how I try to add the pdf attachment.
Is there something wrong in my code or there is a bug in Email::MIME?
I ran it under Windows XP using ActivePerl 5.14.
use strict;
use warnings;
use Email::MIME;
use Email::Sender::Simple qw(sendmail);
use Email::Sender::Transport::SMTP qw();
use utf8;
open my $in, '<', "bogus-report.pdf";
binmode $in;
my $pdf = do { local $/; <$in> };
my $email = Email::MIME->create(
header_str => [
From => 'Oct Râş <m...@example.ro>',
To => 'Me too <m...@gmail.com>',
Subject => 'Subj ţţţ',
],
parts => [
Email::MIME->create(
body_str => "Hello there",
attributes => {
content_type => "text/plain",
charset => "US-ASCII",
encoding => "quoted-printable",
},
),
Email::MIME->create(
body => $pdf,
attributes => {
content_type => "application/pdf",
name => "bogus-report.pdf",
filename => "bogus-report.pdf",
encoding => "quoted-printable",
},
),
],
);
Thanks
--Octavian