POP from CGI doesn't work
I'm trying to make the sample from rebol.org working as a CGI-app.
(I've sligly modified the code only to display the 2 first messages.)
---begin mailview.r---
REBOL [
Title: "Email Viewer (as web page)"
File: %mailview.r
Date: 10-Sep-1999
Purpose: {
This example displays all of your pending email
as an HTML web page. (But does not remove it.)
}
Note: {
Does not remove the mail from the server.
See the popspec.r file for examples of how
to setup your mailbox connection.
}
]
html: make string! 10000 ; where new page is stored
emit: func [data] [append html reduce data]
inbox: open load %popspec.r ;file contains POP email box info
emit [
<html><body>
<center><H3>"Mailbox Summary for " now/date " " now/time </H3>
length? inbox " message(s)" </center><p>
<table border="1" width="100%">
]
for count 1 2 1 [
mail: import-email pick inbox count
emit [
<tr></tr>
<tr><td>"From:"</td><td><b> first mail/from </b></td></tr>
<tr><td>"Subject:"</td><td><b> mail/subject </b></td></tr>
<tr><td>"Length:"</td><td> length? mail/content </td></tr>
<tr><td></td><td><pre> </pre></td></tr>
]
]
emit [<table><p></body></html>]
close inbox
print html
---end mailview.r---
---begin popspec.r---
REBOL [
Title: "POP Email Port Spec"
File: %popspec.r
Date: 10-Sep-1999
Purpose: {
POP port specification used to connect to an email
server. All of the mail reading examples use this.
}
Note: {
You can specify either a URL or a block containing
the necessary information to open the POP port.
The block approach is more general, as the username
and password can be prompted for at run time.
}
]
;pop://user:[EMAIL PROTECTED] ; use this, or use:
[
scheme: 'pop
user: "name"
pass: "pass1"
host: "domain.com" ; uncomment if needed.
]
---end popspec.r---
Everything works fine if the program is runned from REBOL. I've tried
both on Win32 and FreeBSD. I've tried it with '--cgi' and '-cs'. It
works fine.
When I run the program from a webserver (I've tried 24Link on Win32,
and Apache on FreeBSD, I get a "500 Server Error".
What is wrong? When the program runs fine outside a webserver, and
doesn't run inside one? I've made other REBOL programs, and they run
well, on a webserver, but when I use "open pop://...." it just hangs.
Is this a security issue? Isn't it enought to use '-cs'?
Yours faithfully
Martin Ancher Holm <[EMAIL PROTECTED]>