From 365b378f4b86f6ddc515d3c3654ebdafa7c87365 Mon Sep 17 00:00:00 2001 From: yinle Date: Thu, 25 Sep 2014 15:31:11 -0700 Subject: [PATCH] add check before sending mail to avoid mail warning --- xCAT-server/share/xcat/tools/xCATreg | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xCAT-server/share/xcat/tools/xCATreg b/xCAT-server/share/xcat/tools/xCATreg index b469b5729..2d8ba1fb1 100755 --- a/xCAT-server/share/xcat/tools/xCATreg +++ b/xCAT-server/share/xcat/tools/xCATreg @@ -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; }