in reply to reading of log files
sub Notify { local $Message = $_[0]; &MailMessage(${MailList},"***${JobName}: ${Host}: ${Message} ${LogFil +e}",${LogFile},${Host} ); }; sub MailMessage { # This file will send mail to the recipient with the given subject. # If the body is supplied, it will also be sent. If a sender is # supplied, the message will be marked with that sender in the "From" # field. local $Recipient = $_[0]; local $Subject = $_[1]; local $Body = $_[2]; local $Sender = $_[3]; $Recipient =~ s/\n+//; $Subject =~ s/\n+//; $Sender =~ s/\n+//; if (!defined $MailFile) { if ($OSFlag ne "Y") { &DefineOS; }; $MailFile = "${Temp}/mis_mail.$$"; }; if (-r $Body) { open (MAILFILE, "> $MailFile"); open (BODY, "$Body"); while (<BODY>) { print MAILFILE "$_"; }; close (BODY); close (MAILFILE); } else { open (MAILFILE, "> $MailFile"); print MAILFILE "$Body"; close (MAILFILE); }; if ($OS eq "MSWin32") { $Mail = qq! $Mail $MailFile -t "$Recipient" -s "$Subject" ! . qq! -i "$Sender" -f "$Sender" !; print "using blat...\n"; open (MAIL, "| $Mail"); while (<MAIL>) { print $_; }; close (MAIL); print "closing blat...\n"; } else { open (MAILFILE, "$MailFile"); open (MAIL, "| $Mail $Recipient"); print MAIL "To: $Recipient\n"; print MAIL "From: $Sender\n"; print MAIL "Subject: $Subject\n"; while (<MAILFILE>) { print MAIL $_; }; print MAIL "\n.\n"; close (MAIL); close (MAILFILE); }; $mesg = "Mail sent to $Recipient\n"; LogMessage($mesg); unlink ("$MailFile"); };
|
|---|