sub open { my($self, $hdrs) = @_; my $exe = *$self->{Exe}; # || Carp::croak "$self->open: bad exe"; my $args = *$self->{Args}; _cleanup_hdrs($hdrs); my @to = $self->who_to($hdrs); $self->close; # Fork and start a mailer (defined($exe) && open($self,"|-"))=======> Error is coming on this line || $self->exec($exe, $args, \@to) || die $!; # Set the headers $self->set_headers($hdrs); # return self (a FileHandle) ready to accept the body $self; } sub _cleanup_hdrs { my $hdrs = shift; my $h; foreach $h (values %$hdrs) { foreach (ref($h) ? @{$h} : $h) { s/\n\s*/ /g; s/\s+$//; } } }