Perl : corrupted excelsheet while trying to open


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl : corrupted excelsheet while trying to open
# 1  
Old 03-29-2013
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.

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 ?
# 2  
Old 04-01-2013
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need to extract jil file details in a excelsheet

I am very new to shell scripting. I have a autosys jil file that looks like :-- /* ------------- JOB1 ------------------ */ insert_job: JOB1 job_type: b owner: cm@pelonmuck permission: gx,ge,wx,we,mx,me date_conditions: 1 days_of_week: mo,tu,we,th,fr,su start_time: "18:30"... (9 Replies)
Discussion started by: newbie_shell
9 Replies

2. Shell Programming and Scripting

PERL - issue with OPEN

Hi, I have a menu script written in PERL which calls some shell scripts and displays the return. I'm having a problem with OPEN. A section of the code is below: `./scriptlist.ksh 1`; open OUTPUT, "</home/$SCRIPTUSER/output"; { local $/ = undef; $_ =... (2 Replies)
Discussion started by: chris01010
2 Replies

3. Shell Programming and Scripting

open a webpage through perl script

Hi All Can anyone please help me how to open a webpage suppose(Google) with the help of perl script and refresh it after every 5 minutes. (0 Replies)
Discussion started by: parthmittal2007
0 Replies

4. Shell Programming and Scripting

Unable to open a file in perl

Not able to open a file using this code why not? use strict; use warnings; my $file = "verInfo.txt"; unless(open FILE, $file) { # Die with error message # if we can't open it. die "\nUnable to open $file\n"; } my $line = <FILE>; print $line; close FILE; (7 Replies)
Discussion started by: srijith
7 Replies

5. Shell Programming and Scripting

Perl - Grep open file more then once.

Hi, I am using File::Find to go through a very large tree. I am looking for all xml files and open only those that contain a tag <Updated>. I then want to capture the contents of two tags <Old> and <New>. My problem is, after I open the file and do the first grep for <Updated> (which does... (3 Replies)
Discussion started by: OldGaf
3 Replies

6. Shell Programming and Scripting

Help !! perl open function

Help Please perl Gurus, I am trying to add ungrouped passengers in a group and I creating a script however it fails on first step only I tried all the options it returns following error. syntax error at junki line 4, near "open " Execution of junki aborted due to compilation errors. ... (2 Replies)
Discussion started by: dynamax
2 Replies

7. Shell Programming and Scripting

Perl open a remote shell

Hello , I am writing a script which takes the user name , password and hostname from the database and login to the server . I am only able to login to the server and my script logs out and only I can run few command if I provide those command in my script else I am not able to run those... (11 Replies)
Discussion started by: pratapsingh
11 Replies

8. Shell Programming and Scripting

Corrupted Download with Net::FTP (perl)

Hello, I am trying to download several files from a remote FTP server using Net::FTP from within a perl script. The files download alright, except they appear to be corrupted. I know this because once after downloading, I use bzcat to pipe the files to a split command, and bzcat complains saying... (3 Replies)
Discussion started by: amcrisan
3 Replies

9. Shell Programming and Scripting

perl window.open without blocker

Hi Everyone, We know that when we open a popup window, if my IE, Yahoo tool bar enable the popup-blocker, then my window will be blocked. like my code. print <<EOD; <script language=JavaScript> var s = new String(window.location.href); if (s.match(/Start/)){ ... (3 Replies)
Discussion started by: jimmy_y
3 Replies

10. Shell Programming and Scripting

Help with excelsheet generation

Hi All, i have around 50 queries in sybase. We have a requirement where we need to write a unix script, which execute the query one by one & generate the excel sheet & send it to user. I have completed half of the part, where i am executing query one by one & putting the result into a .txt... (4 Replies)
Discussion started by: Amit.Sagpariya
4 Replies
Login or Register to Ask a Question