Ok, first a tip, try running your script from the command line, examples of both tests:
$ REQUEST_METHOD=GET QUERY_STRING='bob=jack&jane=janice' ./sendit.pl $ REQUEST_METHOD=POST CONTENT_LENGTH=20 ./sendit.pl <<EOF bob=jack&jane=janice EOF
Second, I have to admit that my fellow monks are correct, with their suggestion that you should use the CGI module, and should definately not allow unauthenticated users unchecked access to your mailserver, as it will quickly be overcome with spammers. But unfortunately, your bug wouldn't be fixed by either of their solutions, so I'll continue with the analysis. When I ran my tests, I got an error from perl which is causing your 500 error:
Undefined subroutine &main::LMAIL called at ./test.pl line 23.
Incidently, those error messages will also appear in your webservers error logs. If I look at line 23, I can see:
22: open (LMAIL, "|usr/sbin/sendmail -t"); 23: print LMAIL("To: $in{myEmail}\n"); 24: print LMAIL ("From: $in{Email}\n");
Notice the lack of a space between the filehandle LMAIL and your open parenthesis? Perl is interpreting that instance of LMAIL as a call to the function &LMAIL(), which doesn't exist. This is causing it to exit with the error printed above. Putting a space in there should fix your problem. Incidently, you'll also need one of those spaces on line 28 :)


   [ qi3ber ] I used to think that I knew it all, then I started to listen.

In reply to Re: form mail with post, getting "premature ending of script headers" by qi3ber
in thread form mail with post, getting "premature ending of script headers" by edahm

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.