At 10:30 AM 5/22/01 -0500, Stussie, Mike wrote:
>Thanks for the response Peter!
>
>This is being performed through a browser as part of an admin tool and
>when I added the below code as suggested the entire file is sent but all
>the MIME info is displayed on the screen. How can I eliminate this, as it
>would just confuse the user.
You misunderstand - that wasn't a fix for the problem, that was so we could
diagnose what the problem was.
>This is what I added after the shebang line:
>BEGIN {
> $| = 1; print "Content-type: text/html\n\n"
>}
Nope, that should be text/plain. It'll be easier to read.
>I put it at the beginning of the subroutine that sends out the email but
>zero are sent out:
> foreach my $email_address (@email) {
> $| = 1; print "Content-type: text/html\n\n"
Get rid of that line. Run the CGI from a browser through the web
server. See what output is produced. Show us the first 10 lines, and
we'll explain the problem. Something is happening in your email subroutine
that is causing output to go to the web server, and we need to see what it is.
> open (MAIL, "| /var/tmp/sendmail -oi -t -X
> /var/tmp/sendmail_email.log") ||
> display_error("Mail error", "Can't open
> sendmail $!");
>
> print MAIL "To: $email_address\n";
> print MAIL "From: $from\n";
> print MAIL "Cc: \n";
> print MAIL "Subject: $subject_message\n\n";
> print MAIL "$email_text\n";
> close (MAIL) || display_error("Mail error", "Can't close
> sendmail $!");
Also pass $? to display_error.
> }
>
>Any advice would be appreciated,
>
>Regards,
>Mike Stussie
>
>-----Original Message-----
>From: Peter Scott [SMTP:[EMAIL PROTECTED]] Your script is producing output
>that violates the HTTP protocol. Rather than a whole song and dance
>about this (which takes about a chapter - I know, there's a chapter on it
>in my book :-) just put this into your script after the #! line:
>
>BEGIN { $| = 1; print "Content-type: text/plain\n\n" }
>
>and the next time you run it you should see the reason.
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com