my $SERVER = 'mail.domain.com'; ... sub send_text_message { # get our working variables my $to = $_[0]; my $from = $_[1]; my $subject = $_[2]; my $body = $_[3]; eval { my $mail = new Mail::Mailer ('smtp', server=>$SERVER); $mail->open({ From=>$from, To=>$to, Subject=>$subject, }) or die ("Can't send email headers: $!\n"); print $mail $body; $mail->close(); }; if($@) { print $page -> header(-type=> 'text/html', -charset=> 'utf8'), $page->p($@); return 0; } else { return 1; } } #### sub open { my($self, $hdrs) = @_; my $exe = *$self->{Exe}; # || Carp::croak "$self->open: bad exe"; my $args = *$self->{Args}; # removed MO 20050331: destroyed the folding # _cleanup_hdrs($hdrs); my @to = $self->who_to($hdrs); $self->close; # just in case; # Fork and start a mailer (defined($exe) && open($self,"|-")) # <- line dying on || $self->exec($exe, $args, \@to) || die $!; # Set the headers $self->set_headers($hdrs); # return self (a FileHandle) ready to accept the body $self; }