Untested code using Mail::Sendmail to give you an idea why using a module is far better :)
#!/usr/bin/perl -wT use strict; use CGI; use Mail::Sendmail; my $q = new CGI; my $name = $q->param("name"); my $email = $q->param("email"); my $message = $q->param("message"); # Config my $adminmail = "admin\@yoursite.com"; my $from = "whoever\@whatever.com"; my $subject = "enter subject here"; # End config my %mail = ( To => "$adminmail", From => "$from", Subject => "$subject", Message => "$message" ); sendmail(%mail) or die $Mail::Sendmail::error; print $q->redirect("thanks.html") or die "Can't find thanks.html: $!\n +";
Update: You should include Juerd's improvements listed below.
In reply to Re: Contact Form 2
by cjf
in thread Contact Form 2
by venimfrogtongue
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |