develooper Front page | perl.beginners | Postings from March 2003

Help required

Thread Next
From:
Brijesh Kanderia
Date:
March 30, 2003 22:44
Subject:
Help required
Message ID:
023a01c2f751$bac54fa0$07b07bcb@pacific.net.in
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 abc@xyz.com. 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="abc\@xyz.com;

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 -froot\@smtp.pacific.net.in $emailaddr");
printf MAIL "Subject: [PI-IN] Satyaki SMTP Maillog Report ($DATE)\n";
$kitty = `$CAT $mailfile`;
print MAIL "$kitty\n";
close(MAIL);
exit;



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About