Perl : corrupted excelsheet while trying to open

Hi folks,

I am trying to send the mail with spreadsheet attachment in perl.I am able to send the mail with xlsx attachment as well but not able to open the xlsx sheet.While opening the sheet I am receiving the corrupted message.

Below is the code.

use MIME::Lite;
use Net::SMTP;

### Adjust sender, recipient and your SMTP mailhost
my $from_address = 'fromemailid';
my $to_address = 'toemailid';
my $mail_host = 'smtp_ip';

### Adjust subject and body message

my $message_body = "Here's the attachment file(s) you wanted";

### Adjust the filenames
my $my_file_path = "mypath";
my $your_file_xlsx = 'myfile.xlsx';


### Create the multipart container
$msg = MIME::Lite->new (
  From => $from_address,
  To => $to_address,
  Subject => $subject,
  Type =>'multipart/mixed'
) or die "Error creating multipart container: $!\n";

### Add the text message part

### Add the GIF file
$msg->attach (
   Type => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
#   Encoding => 'base64',
   Path => $my_file_path,
   Filename => $your_file_xlsx,
   Disposition => 'attachment'
) or die "Error occured\n";

### Send the Message
MIME::Lite->send('smtp', $mail_host, Timeout=>60);
$msg->send;

Could anyone please let me know what went wrong ?

Could anyone please help me on this ?

Thanks in advance...

Regards,
J

---------- Post updated at 09:28 AM ---------- Previous update was at 02:06 AM ----------

Could anyone please help me on this ?

Thanks in advance...

Regards,
J