Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Send & mail-server problem

 [1/8] from: robert:muench:robertmuench at: 4-Aug-2002 16:15


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? 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

 [2/8] 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
<<quoted lines omitted: 5>>
> 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

 [3/8] from: rebol:optushome:au at: 5-Aug-2002 7:16


----- Original Message ----- From: "G. Scott Jones" <[gscottjones--mchsi--com]> To: <[rebol-list--rebol--com]> Sent: Monday, August 05, 2002 4:16 AM Subject: [REBOL] Re: Send & mail-server problem
> Hi, Robert, > From: "Robert M. Muench"
<<quoted lines omitted: 12>>
> 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. >
I've seen something similar to this when sending a long email that had no line breaks. I reformatted the text to wrap at around 70 chars and the problem was gone. Cheers, Allen K

 [4/8] from: robert:muench:robertmuench at: 7-Aug-2002 6:41


> -----Original Message----- > From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]
<<quoted lines omitted: 7>>
> the email is sent, REBOL sends a "QUIT" command. In response, > then it expects to see "221" followed by any brief message.
Hi, ok I have made a trace of the communication process. Here is what I got: Net-log: ["Opening" "tcp" "for" "smtp"] Net-log: [none "220"] Net-log: {220 localdomain eXtremail V1.5 release 4 rev1 ESMTP server ready ...} Net-log: [["HELO" system/network/host] "250"] Net-log: "250 Hi, I am localdomain" Net-log: "MAIL FROM: <[robert--muench--robertmuench--de]>" Net-log: [none "250"] Net-log: "250 Sender ok" Net-log: "RCPT TO: <[robert--muench--robertmuench--de]>" Net-log: [none "250"] Net-log: "250 Folder ok" Net-log: ["DATA" "354"] Net-log: "354 Write mail. End with '<CR>.<CR>'" Net-log: [none "250"] Net-log: "250 Mail accepted" Net-log: ["QUIT" "221"] ** User Error: Server error: tcp 250 Bye ** Near: close smtp-port
> Hope that this helps. Be sure and let me/us know what comes > up with the extrememail smtp and 'send. --Scott Jones
I think Allens tip concerning the line-breaks might be solution I play around with this idea and let you know. IMO the QUIT is done correctly, right? Robert

 [5/8] from: robert:muench:robertmuench at: 7-Aug-2002 6:41


> -----Original Message----- > From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]
<<quoted lines omitted: 5>>
> that had no line breaks. I reformatted the text to wrap at > around 70 chars and the problem was gone.
I tried to add some 'newline at the end of the mail but no success. Will newline be expanded to CRLF or only CR? Robert

 [6/8] from: gscottjones:mchsi at: 7-Aug-2002 6:27


> On Behalf Of G. Scott Jones > > Looking at the error and the smtp scheme,
<<quoted lines omitted: 4>>
> > command. In response, then it expects to see > > "221" followed by any brief message.
From: "Robert M. Muench"
> Hi, ok I have made a trace of the communication > process. Here is what I got:
<snipped early trace stuff>
> Net-log: [none "250"] > Net-log: "250 Mail accepted"
<<quoted lines omitted: 6>>
> and let you know. IMO the QUIT is done > correctly, right? Robert
Hi, Robert, Thanks for sending back the trace. The trace shows that REBOL correctly wants to send "QUIT" and expects to receive "221 Bye" but instead receives 250 Bye . This suggests that eXtremail (I was obviously mis-spelling it before :-) is sending the incorrect numeric code for sign-off. This point *could* (if you wish) be verified by using a telnet session. From a Windows command-line prompt (*nix may be a little different ... I can't remember) (C means "Client-You Type" and S means "Server Sends"): telnet smtp.mydomain.dom 25 ... then at telnet prompt ... S> 220 localdomain eXtremail V1.5 release 4 rev1 ESMTP server S> ready ... C> HELO S> 250 smtprelay.mydomain.dom C> MAIL FROM: <[myname--mydomain--dom]> S> 250 Sender <[myname--mydomain--dom]> Ok C> RCPT TO: <[myname--mydomain--dom]> S> 250 Recipient <[myname--mydomain--dom]> Ok C> DATA S> 354 Ok Send data ending with <CRLF>.<CRLF> C> A Message C> A Silly Message C> My last line in a silly message C> . S> 250 Message received: 20020804173018.SPSL23220.smtprelay.mydomain.dom@[xx.xx.xx.xx] C> QUIT S> 221 smtprelay.mydomain.dom ESMTP server closing connection My guess is that eXtremail will send an errant last line looking something more like: 250 Bye instead of 221 Bye Another quick way to check this issue is to make a quick hack on REBOL to make it temporarily compliant with what I *think* is going on. In the smtp scheme, the close-check sequence can be altered as follows the prompt in a fresh REBOL session:
>> system/schemes/smtp/handler/close-check
== ["QUIT" "221"]
>> system/schemes/smtp/handler/close-check: ["QUIT" "250"]
== ["QUIT" "250"] This changes the scheme to now look for a "250" in response to the "QUIT" command. Then send yourself a quick email through REBOL. send [myname--mydomain--dom] "Hello, self" If REBOL does not complain, then this suggests that eXtremail is not sending the correct sequence. Please note that this hacked smtp scheme will now *not work* correctly with a compliant server. If a program will need to connect to multiple smtp servers, some compliant and some not, then one REBOL work-around would be to create newly named smtp scheme and send commands for use with eXtremail only. Alternatively, the scheme could be made a little smarter and look for errant servers and then check the alternative closing sequence. Finally, if eXtremail is sending an incorrect sequence, I would suggest sending a correction suggestion to the source maintainer to be fixed in a future release. Just a thought, but obviously very few clients have complained thus far, or the (possible) error would already have been fixed! Hope this hels a bit more. As always, I am very interested in hearing what you find. --Scott Jones

 [7/8] from: robert:muench:robertmuench at: 7-Aug-2002 14:29


> -----Original Message----- > From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]
<<quoted lines omitted: 7>>
> eXtremail (I was obviously mis-spelling it before :-) is > sending the incorrect numeric code for sign-off.
Hi Scott, yep that's how I read this too. So your first guess was completely right :-).
> Another quick way to check this issue is to make a quick hack > on REBOL to make it temporarily compliant with what I *think* > is going on.
I tried this and I got no error :-)).
> If REBOL does not complain, then this suggests that eXtremail > is not sending the correct sequence.
I will post this on the extremail ML and see what the author has to say about it.
> Alternatively, the scheme could be made a little smarter and > look for errant servers and then check the alternative > closing sequence.
I don't know how many non-compliant servers there exist. Maybe this is a good idea anyway.
> Finally, if eXtremail is sending an incorrect sequence, I > would suggest sending a correction suggestion to the source > maintainer to be fixed in a future release. Just a thought, > but obviously very few clients have complained thus far, or > the (possible) error would already have been fixed!
That's what I don't understand too. Are all those clients implemented with very relaxed checks?
> Hope this hels a bit more. As always, I am very interested > in hearing what you find. --Scott Jones
Helped a lot. Thanks! I'll let you know what the extremail author says. Robert

 [8/8] from: gscottjones:mchsi at: 7-Aug-2002 9:30


From: "Robert M. Muench" SJ> > If REBOL does not complain, then this suggests SJ> > that eXtremail is not sending the correct sequence.
> I will post this on the extremail ML and see what the author has to say > about it.
Hi, Robert, Shortly before I received your response, I downloaded the linux package onto my Windows machine, unpacked it, and searched the binary and found the phrase "250 Bye". Your efforts further confirm the suspicion. As a cross check, I double checked the RFC to be sure that 221 is the correct sign-off sequence, and it is. For the curious: http://www.cis.ohio-state.edu/cs/Services/rfc/rfc-text/rfc2821.txt ... and look for ... 3.9 Terminating Sessions and Connections
> > Alternatively, the scheme could be made a little smarter and > > look for errant servers and then check the alternative > > closing sequence. > > I don't know how many non-compliant servers there exist. Maybe this is a > good idea anyway.
Good point. I started hacking to find a way of detecting that the server software is a particular type, and the hack started to get very involved, so I am setting that aside for now.
> > Finally, if eXtremail is sending an incorrect sequence, I > > would suggest sending a correction suggestion to the source
<<quoted lines omitted: 3>>
> That's what I don't understand too. Are all those clients implemented > with very relaxed checks?
My *guess* is "yes" given that once the email data is sent, and the client receives a non-error condition, then maybe sending a "QUIT" without waiting for a return may not be a problem most of the time. It is curious, I admit, which was why I checked the RFC covering smtp. It is amazing that eXtremail would not have received an error report sooner. Will wonders never cease? --Scott Jones

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted