Hi Monks,
I am trying to send an Excel file via perl. With following code, I can send the file, but "my_message" is never get printed and the Excel file' cannot be opened. (It gives some bogus cannot access/read-only file error messages)
use MIME::Entity;
use Mail::Send;
@my_message = qw(Hello world Look at my attachment);
$msg = MIME::Entity->build(From => 'me@myhost.com',
Type => "multipart/mixed",
To => 'user@company.com',
Subject => "Hello, ! ",
Data => \@my_message);
$msg->attach(Path => 'account.xls',
Encoding => '-SUGGEST',
Disposition => "attachment",
'-X-Mailer' => undef,
);
open SENDMAIL, "|/usr/lib/sendmail -t" or die $!;
$msg->print(\*SENDMAIL);
close SENDMAIL;