
kinny
Novice
Sep 30, 2010, 11:29 AM
Post #1 of 2
(1385 views)
|
|
Blank file as Attachment with MIME::LITE
|
Can't Post
|
|
hi Gurus,
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,
|