"$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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.