[smokeping-users] Re: smokeping quits ?

Tobias Oetiker oetiker at ee.ethz.ch
Sat Feb 12 11:02:11 MET 2005


Today Tobias Oetiker wrote:

oops ... this is the right code:

 sub sendmail ($$$){
     my $from = shift;
     my $to = shift;
     $to = $1 if $to =~ /<(.*?)>/;
     my $body = shift;
     if ($cfg->{General}{mailhost} and
         my $smtp = Net::SMTP->new($cfg->{General}{mailhost})){
         $smtp->mail($from);
         $smtp->to(split(/\s*,\s*/, $to));
         $smtp->data();
         $smtp->datasend($body);
         $smtp->dataend();
         $smtp->quit;
     } elsif ($cfg->{General}{sendmail} or -x "/usr/lib/sendmail"){
         open (M, "|-") || exec (($cfg->{General}{sendmail} || "/usr/lib/sendmail"),"-f",$from,$to);
         print M $body;
         close M;
     } else {
         warn "ERROR: not sending mail to $to, as all methodes failed\n";
     }
 }


-- 
 ______    __   _
/_  __/_  / /  (_) Oetiker @ ISG.EE, ETL F24.2, ETH, CH-8092 Zurich
 / // _ \/ _ \/ /  System Manager, Time Lord, Coder, Designer, Coach
/_/ \.__/_.__/_/   http://people.ee.ethz.ch/oetiker +41(0)44-632-5286

--
Unsubscribe mailto:smokeping-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:smokeping-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/smokeping-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the smokeping-users mailing list