Subject: how to mail ??

#!/usr/bin/perl 

foreach (`df -h|grep /dev/hda11`) {
     split();
#       our $total = $_[1];
#       our $used = $_[2];
        our $free = $_[3];
        if ($free =~ /M/){
                $free=~ s/M//;
                print $free."\n";
                if ($free <= 10) {
                        $mesg = "the space left is $free";
                        print("low on space.\n");
                        system('mailx','-s','"Space
low"','[EMAIL PROTECTED]','<',qq($mesg)) == 0 or die "Couldn't
mail $!";
                }
        
        }
    }


this isn't working....i have to press Ctrl+D to send the mail.....this
script will be cronned so i need the mail to be send
automatically......what can i do ?? alternatives???

thnx in adv
Saurabh


Here something that I do routinely...

<snip>
open MAILMAN, "| rmail $To_Address";
print MAILMAN "Subject: Some subject\n";
print MAILMAN "From: $Reply_to\n\n";
print MAILMAN "some message.....";
close MAILMAN;
</snip>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to