in reply to form mail with post, getting "premature ending of script headers"
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:$ 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
Incidently, those error messages will also appear in your webservers error logs. If I look at line 23, I can see:Undefined subroutine &main::LMAIL called at ./test.pl line 23.
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 :)22: open (LMAIL, "|usr/sbin/sendmail -t"); 23: print LMAIL("To: $in{myEmail}\n"); 24: print LMAIL ("From: $in{Email}\n");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: form mail with post, getting "premature ending of script headers"
by jonadab (Parson) on Feb 25, 2003 at 15:55 UTC |