#!c:/program files/apache group/perl/bin/perl.exe -w use CGI; use strict; use warnings; use Mail::Mailer; my $YourEmail = 'mymail@mymail.com'; my $referers = ('abc111'); # Location of mail program - check your doc or ask admin my $MailProgram = 'C:/Program Files/Apache Group/Perl/site/lib/Mail/Mailer/sendmail'; # Subject of the e-mail autoreply to the submitter my $Subject = "Thanks for Your Message!"; # Header line in the auto-reply message my $Header = "GOOBERS UNLIMITED"; # Brief tail message for body of e-mail autoreply my $TailMessage = "If your message requires a reply, we'll get back to you soon."; # Your signature lines the end of the autoreply e-mail ##### END OF SETTABLE VARIABLES ############################ ##### MAIN PROGRAM ######################################### my $query = new CGI; my $sirName = $query ->param("sirName"); my $firstName = $query ->param("firstName"); my $Email = $query ->param("email"); my $Add1 = $query ->param("add1"); my $Add2 = $query ->param("add2"); my $City = $query ->param("city"); my $County = $query ->param("county"); my $Postcode = $query ->param("postcode"); my $Message = $query ->param("Message"); my $mailer = new Mail::Mailer 'smtp', Server => 111.11.1.111; my %headers = ('To' => '$YourEmail', 'From' => '$Email'); my $body = '$Message'; $mailer->open(\%headers); print $mailer $body; ## print $smtp $message; $mailer->close(); ##print "Content-type: text/html\n\n"; exit; #### 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+$//; } } }