add check before sending mail to avoid mail warning

This commit is contained in:
yinle 2014-09-25 15:31:11 -07:00
parent 7ab784ea38
commit 365b378f4b

View File

@ -1501,9 +1501,13 @@ sub send_mail {
my $mailprog = "/bin/mail";
my $sendmail = "echo \"$content\"";
send_msg(2, "begin to send mail , the contents is $sendmail\n");
my $send = $sendmail." | $mailprog -s \"$subject\" \"$confkeys{mailgroup}\" ";
system($send);
send_msg(2, "finish sending mail, $send\n");
if ($confkeys{mailgroup}) {
my $send = "$sendmail"." | $mailprog -s \"$subject\" \"$confkeys{mailgroup}\" ";
system($send);
send_msg(2, "finish sending mail, $send\n");
} else {
send_msg(1, "can't send mail to nobody ");
}
return 0;
}