title: connect to localhost failed (Connection refused) no (more) retries
body: <p>I want to send an email using perl ,but when i execute the command as follows:    </p>
  
  <pre><code>#./sendmail.sh "par1" "par2" "par3"
  </code></pre>
  
  <p>i got the error msg "connect to localhost failed (Connection refused) no (more) retries"</p>
  
  <p>sendmail.sh:<br>
  <code>/usr/bin/perl /code/sendmail.pl "$1" "$2" "$3"</code>;</p>
  
  <p>sendmail.pl:</p>
  
  <pre><code>#!/usr/bin/perl -w
   use Mail::Sendmail;
  my $event1 = shift(@ARGV);
  my $event2 = shift(@ARGV);
  my $time = shift(@ARGV);
  #my $info = shift(@ARGV);
  my $datetime = `/bin/date "+20%y-%m-%d %H:%M:%S"`;
     chomp $datetime;
     $msg = "This is Monitor System speak:\n
  The system discovers the events at $datetime.
  Something may be abnormal, please check it. The detail is below:\n";
  $msg = $msg."$event1 and $event2 at $time\n";
  $msg = $msg."\n";
  $msg = $msg."Any problem, check it from http://map_test.php\n\n\n";
  $mail_subject = "Abnormal";
  sendmail(
      From =&gt; 'localhost',
      To =&gt; 'test@mail.com',
      Subject =&gt; $mail_subject,
      Message =&gt; $msg,
  );
  </code></pre>
  
  <p>Any help appreciated.</p>