I just ran it on my server, as you've posted it here, and it ran just fine, no "end of headers" message, but as you say, sent an email with no content.

That's pretty much what you'd expect running just that script by itself, because there's no form feeding it with information.

Here's a quick fix for your problem.

Start again.

Start with this code:

use CGI; use CGI::Carp qw(fatalsToBrowser); CGI::ReadParse();
now all the values from your form are in a hash called "%in".

So if you've got a field called "Title", the contents are now easily accessed because they're in $in{'Title'}.

Note that there's a case-sensitivity issue here too. If your form field is called "title" then you need $in{'title'} instead.

You don't need to grab things from the hash and put them into variables, just grab them directly from the hash, i.e. do this

print MAIL "$in{'Title'}\n";
in your mail-sending code, rather than doing that bizarre "GETVALUES" thing which is just double handling. Skip that stage altogether. Just go straight to sending the mail.

And the fatalsToBrowser thing will mean you get useful error messages.



($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss') =~y~b-v~a-z~s; print

In reply to Re: Re: Re: Premature end of script headers by Cody Pendant
in thread Premature end of script headers by Nickd_69

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.