Where is the attached file opened with Email::MIME?
[email protected] ("Octavian Rasnita") Sun, 16 Nov 2014 00:50:54 +0200
| Newsgroups | perl.pep |
|---|---|
| Message-ID | <054E23F59122437B9B1355DE9D9C4286@octavianf303f0> |
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âş <[email protected]>',
To => 'Me too <[email protected]>',
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