"$adminmail"
"$foo" is often very bad style. Consider it equal to '' . $foo . '', and just write it without quotes instead. Also, using single quotes allows you to write @ signs without escaping them (style advice: use double quotes only if you use their's specialties (read perlop)).
You use %mail just once, and could have put that in the sub itself.
In my style, this script would be:
#!/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 +";
U28geW91IGNhbiBhbGwgcm90MTMgY
W5kIHBhY2soKS4gQnV0IGRvIHlvdS
ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
geW91IHNlZSBpdD8gIC0tIEp1ZXJk
In reply to Re: Re: Contact Form 2
by Juerd
in thread Contact Form 2
by venimfrogtongue
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |