[REBOL] Re: Send & mail-server problem
From: gscottjones:mchsi at: 4-Aug-2002 13:16
Hi, Robert,
From: "Robert M. Muench"
> Hi, I'm running the eXtremail mail server (http://www.extremail.com/)
> for all of my and my companies SMTP stuff. I'm testing Phil's readmail
> mail reader and have written some Rebol CGI scripts that send emails.
> Sending mails with 'send works up to only one thing:
>
> ** User Error: Server error: tcp 250 Bye. ** Where: close smtp-port
>
> So, the mail is send correctly but the 'send function thinks there was
> an error and states this error. There seems to be some things extremail
> is sending that lets 'send make the error assumption.
>
> Does anyone has an idea what the problem could be? How to fix it?
Looking at the error and the smtp scheme, I think that the most likely
problem is that the mail server is sending a nonstandard sign-off sequence.
Normally, after the body of the email is sent, REBOL sends a "QUIT" command.
In response, then it expects to see "221" followed by any brief message. My
guess is that extrememail is (probably erroneously) sending "250 Bye". 250
is usually only sent following a correct sign-on or correct command/data
sequence, not for the sign-off command.
The simpliest way to check this theory is to start a fresh console session,
turn trace/net on, and send a sample email to the extrememail server.
Something like this:
trace/net on
send [myname--mydomain--dom] "Hello, self"
Then read the output of the trace. The final two lines should read
something like:
Net-log: ["QUIT" "221"]
Net-log: {221 arelay.mydomain.dom ESMTP server closing connection}
It is here that I'm guessing that extrememail is sending something like "250
Bye ....." If this is the case, then I can easily hack a work-around for
REBOL and you can submit a correction to the extrememail source keeper if
desired.
Of course, to turn off trace, use "trace/net off" :-)
> And how can I stop Rebol/Core in CGI mode to output an error message,
> because this will be sent to the web-browser as result. Robert
One way is to "wrap" the critical functions in error try? block. Something
like the following pseudo code:
either error? try [
;function that may cause an error, like 'send with extrememail
send [myname--mydomain--com] "Hello, if not error"
][
print "usual response to be printed to the web page, like e-mail
sent"
][
print "error response to be printed to the web page, like in sending
e-mail"
print "with instructions on how to retry or correct the error"
]
Hope that this helps. Be sure and let me/us know what comes up with the
extrememail smtp and 'send.
--Scott Jones