#!c:\perl\bin\perl #-w # #use strict; use Time::Format qw(%time %strftime %manip); use Net::SMTP; use File::Copy; $ctime="$time{'hh:mm'}"; $yesterday="$time{'yyyymmdd', time-24*60*60}"; $lastmonth="$month_len[$month - 1]"; $cdate="$time{'yyyy.mm.dd'}"; $file1="OPTUS.ECBOT.ZIP"; $log="email.log"; my $subject = "subject"; my $mailfrom = "email@mail.com"; my $mailto = "email@mail.com"; print "Sending message to $mailto\n"; my $stat_filename = "email.log"; my ($serverName) = "mailserver"; my $smtp = Net::SMTP->new($serverName, Timeout => 60); # die "Couldn't connect to server $smtp" unless $smtp; $smtp->mail( $mailfrom ); $smtp->to( $mailto ); $smtp->data(); $smtp->datasend("From: ", $mailfrom, "\n"); $smtp->datasend("Subject: $subject\n"); $smtp->datasend("MIME-Version: 1.0\n"); $smtp->datasend("Content-Disposition: attachment; filename=\"OPTUS.ECBOT.ZIP\"\n"); $smtp->datasend("Content-Type: application/zip; name= $file1 "); $smtp->dataend(); $smtp->quit(); exit;