CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Advanced:
Blank file as Attachment with MIME::LITE

 



kinny
Novice

Sep 30, 2010, 11:29 AM

Post #1 of 2 (2865 views)
Blank file as Attachment with MIME::LITE Can't Post

hi Gurus,

Code
use MIME::Lite; 
my $outDir = "C:/" ;
my $outFile = "wkly device rpt "."$today.xls";
my $file = "$outDir"."$outFile";
my $subject = " Weekly Report for $today";
my $msg = "Hi ";
#Open the File for Writing
open (OUTPUT, ">$file") || die print "Cannot open $file\n";
print OUTPUT "FOUNDATION_ACCT_NUM\tORDER_ID\tSTATE\tCREATION_DATE\tLOSGTYPE\tDESCRIPTION\tPRODUCT_ID\tDISPLAY_NAME\tPRODUCT_TYPE\tWIRELESS\#\tPLAN_NAME\n";

my $message = MIME::Lite->new(
From => 'xxx@xxx.com',
To => 'xxxx@xxx.com,xxx@xxx.com',
Subject => $subject,
Data => $msg
);
# add the attachment
$message->attach(
Type => "application/txt",
Path => "$file",
#Filename => "$outFile",
Disposition => "attachment"
);
$message->send('smtp','xxxxx.net', Debug =>1);


This is sending a blank attachment.I see that the file is not blank and is available in C:/.
I am running this on Windows XP.
Can anyone explain and suggest me ways to correct this code.

Thanks in advance,


FishMonger
Veteran / Moderator

Sep 30, 2010, 3:48 PM

Post #2 of 2 (2857 views)
Re: [kinny] Blank file as Attachment with MIME::LITE [In reply to] Can't Post

Close the file before attaching it to the email.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives