> print "</body><html>"

This should be </html> - but that would not have caused the error you
reported.

Here's a generic email script that I've been using. The form uses the
same variable names you see here (TO, FROM, SUBJECT). Note that you can
add variables in the form, and REBOL will automatically be appended
them to the content. The thing I've been meaning to add is a way to
redirect the user to a confirmation page from the HTML form.

--

#!/usr/bin/rebol --cgi
REBOL[Title: "Contact CGI" ]

;- Configure Internet Mail, if necessary
; set-net [ ] 

;- Create object based on system/standard/email with usual defaults.
;- (!) Added FROM_NAME for personal name
email-obj!: make object! [
    TO: none
    CC: none
    BCC: none
    FROM: none
    FROM_NAME: none
    REPLY-TO: none
    DATE: none
    SUBJECT: none
    RETURN-PATH: none
    ORGANIZATION: ""
    MESSAGE-ID: none
    COMMENT: none
    X-REBOL: {2.2.0.3.1 "The Internet Messaging Language (TM)
WWW.REBOL.COM"}
    MIME-VERSION: none
    CONTENT-TYPE: none
    CONTENT: none

]

;- Retrieve HTML form variables from either CGI Environment or Standard
Input
email-obj: make email-obj! decode-cgi either
system/options/cgi/request-method = "GET"
[system/options/cgi/query-string] [make string! input]

;- Tweak email object
set in email-obj 'FROM to-string join email-obj/FROM_NAME [" <"
email-obj/FROM ">"]
set in email-obj 'REPLY-TO email-obj/FROM
set in email-obj 'SUBJECT join "[CONTACT] " email-obj/SUBJECT
;- (!) Work around bug in send - skips first line of CONTENT thinking
it's the SUBJECT
set in email-obj 'CONTENT join email-obj/SUBJECT [crlf
email-obj/CONTENT]

;- Send it - Message is in email-obj
send/header to-email email-obj/TO "" email-obj

;- Confirm it
print {Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<!-- base href="" -->
<title>Contact Confirmed</title>
<body>
<p align=center>Thank you for contacting us.</p>
</body>
</html>
}
;- END OF PRINT

;- Done
quit



-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 425-0252; Fax 716 223-2506.
-- http://www.husted.com/


Reply via email to