Re: [Way OT] perl, CGI, and sendmail
On Mon, Apr 11, 2005 at 02:31:26AM +0200, Almut Behrens wrote:
> On Sun, Apr 10, 2005 at 05:27:34PM -0500, David wrote:
> > On Sun, Apr 10, 2005 at 11:25:48PM +0200, Almut Behrens wrote:
> > > When a CGI script doesn't produce any output, it's
> > > considered an "internal error" by the server.
> > But I was getting output. In the sendmail example I included, I
> > received a perfect mail. As I said in the OP, no errors showed up in
> > the exim logs, but I'd get an "Internal Error" report in the web browser
> With output I meant _output sent to the browser_ -- i.e. printed to
> stdout. In your script, you're just printing a message to SENDMAIL.
Yes, I finally found this out, as you and Andrew Perrin explained it.
About 3 hours ago, I sent a reply, inadverently sent to Steve Patterson
rather than the list - dunno how I did that - explaining that I had
removed a line "print header;" from the code. The pattern I was using
was a dual-purpose thing that would either send an email or web page or
both.. I assumed that this line would only be needed for the HTML, not
understanding that _some_ HTML output was required. When I edited the
script to send HTML, I added that line back in - thus no error - but
removed it again when I converted back to sending mail.
> Sending this mail is considered just a "side effect" CGI-wise. You
> still have to generate some HTML content to be sent to the browser.
> IOW, after your "print SENDMAIL <<"end_html"; ..." statement, add some
> code to send HTML content to stdout. Or, use HTTP status code 204.
> To start with, however, it's probably easier to just generate any page
> to be shown in response to submitting the form... :)
Yes. I know that now.. I guess if I'd read the documentation I'd have
known it all along :(
Thanks to all who replied.