The best solution to your current problem is NMS formmail. You will find a variety of well written Perl CGI widgets (including NMS formmail) ready to go here: http://nms-cgi.sourceforge.net/ DO NOT UNDER ANY CIRCUMSTANCES USE THE NON NMS VERSION OF FORMMAIL.

At the very least it will point you towards the basis of good Perl coding, but you will find that the formail does exactly what you are trying to do in a reliable and secure way. The main functional issue with your script as it exists is that you don't GET the form input into the formdata hash anywhere. You have been shown how to use the CGI module to do this above.

cheers

tachyon


In reply to Re: Hand-rolled CGI mailto by tachyon
in thread Hand-rolled CGI mailto by prowebdesigner

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.