#!/usr/bin/perl -w # Well, to be completely honest: I don't like CGI.pm, and wouldn't use it. # I will for now, because I'm just rewriting :) # You may have noticed I removed the tainting checks too. use strict; use CGI; use Mail::Sendmail; my $q = CGI->new(); # Updated as per particle's excellent observation my $name = $q->param('name'); # Note: used only once my $email = $q->param('email'); # Note: only used once my $message = $q->param('message'); # # Note: couldn't choose ;) # Config my $adminmail = 'admin@yoursite.com'; my $from = 'whoever@whatever.com'; my $subject = 'enter subject here'; # End config sendmail( To => $adminmail, From => $from, Subject => $subject, Message => $message ) or die $Mail::Sendmail::error; # Note: redirects should be absolute # (All modern browsers handle relative redirects, though) print $q->redirect('thanks.html') or die "Can't find thanks.html: $!\n";