#!/usr/bin/perl -w
my $MAIL_TO = '******@****.com';
my $g_send_alarm = 0;
my $hostname = `hostname`;
chomp ($hostname);
my $MAIL_SUBJECT = "sys warning:$hostname";
open REPORTFILE,"|mail -s '$MAIL_SUBJECT' '$MAIL_TO'" or die "report_file : $!";
print REPORTFILE "test \n";
my $MAIL_TO = '******@****.com';
my $g_send_alarm = 0;
my $hostname = `hostname`;
chomp ($hostname);
my $MAIL_SUBJECT = "sys warning:$hostname";
open REPORTFILE,"|mail -s '$MAIL_SUBJECT' '$MAIL_TO'" or die "report_file : $!";
print REPORTFILE "test \n";
close(REPORTFILE);
最开始忘记在 |mail -s $MAIL_SUBJECT这加上引号把subject引起来,这样导致mail按照空格切分字段时认为subjuect只是sys字段,后边的顺延了!