Hello fellow perl enthusiasts
I want to be able to open a Mail File Handle
and have seperate file go this Mail File Handle
I have some code like this:
-----------------------------------------------
#!/util/perl5.static -w

$unixadm = "hourihj";
$report = "/etc/passwd";
$hostname = qx(/usr/ucb/hostname);
$subject = "FSADM Report on $hostname";
#$mail = "/usr/ucb/mail";

&mail_results2;
open(REPORT, "$report") || die 
"Cannot open $report:$!";

### mail_results subroutine
sub mail_results2 {
open(SENDMAIL, "|/usr/lib/sendmail -oi -t -odq")
    or die "Can't fork for sendmail:$!\n";
 $text = "";
    while (read (REPORT, $newtext, 1)){
        $text .= $newtext;
    }

print SENDMAIL <<"EOF";
From: Root <root>
To: Unix Admin <$unixadm>
Subject: $subject
Hello
$text
EOF
close(SENDMAIL) or warn "sendmail didn't close nicely";
}
-------------------------------------------------------

Thanks in Advance

Jaime

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to