Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying Email an Attachment with the File name that is Yesterdays date

Status
Not open for further replies.

dshaw21369

Programmer
Jul 8, 2002
64
0
0
I'm Sending an html attachment using MIME:LITE and the email is sending an attachment however the html attachment displays all the file names in the directory rather than the html contents. My Ultimate Goal is to attach an html file with yesterdays date. Any Suggestions?
Here is my code.

#!/usr/bin/perl


$yesterday = time() - 86400; # 86400 is num seconds in 1 day
($sec, $min, $hours, $day_of_month, $month, $year , $wday, $yday, $isdst) = localtime($yesterday);
$month++;

$Reports_Path = '/export/home/egate/egate/client/SeeBeyond_Yesterdays_Output_Files';
$reports_filebase ='reports';
$reports = $reports_filebase.sprintf("_%02d_%02d_%02d.htm", $month, $day_of_month, $year % 100);


use MIME::Lite '/usr/perl5/site_perl/5.005/MIME';


$msg = MIME::Lite->new(
To =>'denesa.k.shaw@centerpointenergy.com',
Subject =>'Yesterdays Reports',
Type =>'multipart/mixed'
);

$msg->attach(Type => 'text/html',
Path => "$Reports_Path",
Filename =>"$reports\n",
Disposition => 'attachment'

);
$msg->send();


 
I Fixed it with this:



########################################## TIME STAMP INFORMATION #######################################


$yesterday = time() - 86400; # 86400 is num seconds in 1 day
($sec, $min, $hours, $day_of_month, $month, $year , $wday, $yday, $isdst) = localtime($yesterday);
$month++;

$reports_filebase = '/export/home/egate/egate/client/SeeBeyond_Yesterdays_Output_Files/reports';
$reports = $reports_filebase.sprintf("_%02d_%02d_%02d.htm", $month, $day_of_month, $year % 100);

use MIME::Lite '/usr/perl5/site_perl/5.005/MIME';


$msg = MIME::Lite->new(
To =>'denesa.k.shaw@centerpointenergy.com',
Subject =>'Yesterdays Reports',
Type =>'multipart/mixed'
);

$msg->attach(Type => 'text/html',
Path => "$reports",
Filename =>"$reports\n",
Disposition => 'attachment'

);
$msg->send();
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top