Hi Louis,

a little off-topic, but it is more efficient to collect your output in a
string and print the complete string in one go, using a single call to
print. Like so:

output: make string! 1000

insert output {Content-Type: text/html^/^/
<html><body><h2>Results:</h2>}

cgi: make system/standard/email decode-cgi system/options/cgi/query-string

either all [
     email? try [cgi/to: load cgi/to]
     email? try [cgi/from: load cgi/from]
][
     append output "<B> Sending Email to cgi/to </B>"
     send/header cgi/to cgi/content cgi
][
     append output  "<B>Invalid email to or from address</B>"
]

print [output "</body><html>"]




At 07:32 PM 5/17/00 -0500, you wrote:
>Here's the script:
>
>#!rebol -cs
>
>REBOL [
>     Title: "Sends Email via CGI Form"
>     Date:  20-July-1999
>     File:  %cgiemailer.r
>     Purpose: {
>         Uses a Web form to send an email message.
>     }
>]
>
>print "Content-Type: text/html^/^/"  ;-- Required Page Header
>
>print "<html><body><h2>Results:</h2>"
>
>cgi: make system/standard/email decode-cgi system/options/cgi/query-string
>
>either all [
>     email? try [cgi/to: load cgi/to]
>     email? try [cgi/from: load cgi/from]
>][
>     print [<B> "Sending Email to" cgi/to </B>]
>     send/header cgi/to cgi/content cgi
>][
>     print "<B>Invalid email to or from address</B>"
>]
>
>print "</body><html>"
>
>And here is the HTML:
>
>
><HTML>
>
><HEAD>
>     <META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
>     <TITLE>untitled</TITLE>
></HEAD>
>
><BODY BGCOLOR="white">
>
><FORM ACTION="http://worldmerchantltd.com/www/cgi-bin/cgiemailer.r" 
>METHOD="GET">
><H2><FONT FACE="Arial, Helvetica">Send an Email Message:</FONT></H2>
><P>
><TABLE BORDER="1" CELLSPACING="1" WIDTH="75%" BGCOLOR="silver">
>     <TR>
>         <TD WIDTH="9%" BGCOLOR="#3C6F99">
>             <P ALIGN="RIGHT"><B><FONT COLOR="white">To:</FONT></B>
>         </TD>
>         <TD><INPUT TYPE="TEXT" NAME="to" SIZE="40"></TD>
>     </TR>
>     <TR>
>         <TD WIDTH="9%" BGCOLOR="#3C6F99">
>             <P ALIGN="RIGHT"><B><FONT COLOR="white">From:</FONT></B>
>         </TD>
>         <TD><INPUT TYPE="TEXT" NAME="from" SIZE="40"></TD>
>     </TR>
>     <TR>
>         <TD WIDTH="9%" BGCOLOR="#3C6F99">
>             <P ALIGN="RIGHT"><B><FONT COLOR="white">Subject:</FONT></B>
>         </TD>
>         <TD><INPUT TYPE="TEXT" NAME="subject" SIZE="40"></TD>
>     </TR>
>     <TR>
>         <TD WIDTH="9%" BGCOLOR="#3C6F99">
>             <P ALIGN="RIGHT"><B><FONT COLOR="white">Message:</FONT></B>
>         </TD>
>         <TD><TEXTAREA NAME="content" ROWS="10" COLS="40"></TEXTAREA></TD>
>     </TR>
></TABLE>
></P>
>
><P><INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Send Message">
></FORM>
>
></BODY>
>
></HTML>
>
>At 04:07 PM 5/17/00 -0700, you wrote:
>>Louis wrote:
>> > CGI Error
>> > The specified CGI application misbehaved by not returning a complete 
>> set of
>> > HTTP headers. The headers it did return are:
>>
>>Is your script printing a Content-type header as the first thing it
>>does, followed by a blank line?
>>
>>print "Content-type: text/html^/^/"
>>
>>Kev
>>
>>------------------------------------------------------------------------
>>Kevin McKinnon, Network Engineer                 [EMAIL PROTECTED]
>>Sunshine Communications                     http://www.sunshinecable.com
>>
>>PGP Public Key: http://www.dockmaster.net/pgp.html   PGP 6.0 www.pgp.com
>
>
>

;- Elan >> [: - )]

Reply via email to