sub sendmail{ my ($fromemail,$fromname,$toemail,$toname,$subject,$message)=@_; @_ == 6 or die "Improper number of arguments for sendmail function"; my $smtp=Net::SMTP->new($globalMailServer) or die ("Can't connect to mail server '$globalMailServer'\n"); $smtp->mail($fromemail); if(ref $toemail){ $smtp->to(@$toemail); } else{ $smtp->to($toemail); } $smtp->data(); $smtp->datasend("To: $toname\n"); $smtp->datasend("From: $fromname\n"); $smtp->datasend("Subject: $subject\n"); $smtp->datasend("\n"); $smtp->datasend($message); $smtp->dataend(); $smtp->quit(); }