Hi All,

I dont have very much idea about perl programing. I have writen a small script which 
reads the content of one file which keeps on changing daily. and sends the out put to 
the concerned person thru mail.

Now what I want is that I dont want the contents. I want this script to send this txt 
file as an attachment to [EMAIL PROTECTED] now pls tell me how to do this.

Regds
Brij

 
#!/usr/bin/perl

sub get_date();

$SENDMAIL = "/usr/sbin/sendmail";
$CAT = "/bin/cat";
$logdir="/root";
$mailfile = "$logdir/maillog.txt";
mailto:$emailaddr="[EMAIL PROTECTED];

get_date();

sub get_date()
        {
        $DATE   = `date +%Y%m%d`;
        chop ($DATE);
        #$day   = `date +%d`;
        #chop ($day);
        #$hour = `date +%H`;
        #chop ($hour);
        }

# send mail to whoever concerned
open (MAIL, "| $SENDMAIL [EMAIL PROTECTED] $emailaddr");
printf MAIL "Subject: [PI-IN] Satyaki SMTP Maillog Report ($DATE)\n";
$kitty = `$CAT $mailfile`;
print MAIL "$kitty\n";
close(MAIL);
exit;

Reply via email to