Here is the code for sending a email:
use Email::MIME;
use IO::All;
my @parts = (
Email::MIME->create(
attributes => {
filename => "report.xls",
content_type => "application/vnd.ms-excel",
encoding => "base64",
},
body => "Body added as per the answer to this question" #no effect
),
Email::MIME->create(
attributes => {
content_type => "text/plain",
charset => "US-ASCII",
encoding => "base64",
},
body_str => "$body_of_message",
),
);
use Email::Send;
my $sender = Email::Send->new({mailer => 'SMTP'});
$sender->mailer_args([Host => 'localhost']);
$sender->send($email);
Now I am able to send mail and but report.xls
is empty i.e. 0 bytes. It is present in my local directory and I am unable to understand why it is not being picked up as attachment. I have tried giving absolute path also but that does not work too.