Dear Monks,
I am trying to send email with pdf file via catalyst::plugin::email module.
However, after I check the email and download the attatched pdf file, I just got "file damaged" message.
I am sure the original pdf file can be opened normally.
Please help me to find what is wrong with my code. Thanks!
my @parts = (
Email::MIME->create(
attributes => {
content_type => 'application/pdf',
encoding => 'quoted-printable',
name => 'document.pdf',
},
body => io( 'document.pdf' )->all,
),
Email::MIME->create(
attributes => {
content_type => "text/plain",
disposition => "attachment",
charset => "US-ASCII",
},
body => "Hello there!",
),
);
my $r = $c->email(
header => [
From => 's4@student.tku.edu.au',
To => 's3@student.tku.edu.au',
Subject => 'Hello!'
],
parts => [ @parts ],
);