Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 49878 invoked from network); 24 Aug 2007 09:26:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Aug 2007 09:26:34 -0000 Received: (qmail 44460 invoked by uid 500); 24 Aug 2007 09:26:28 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 44434 invoked by uid 500); 24 Aug 2007 09:26:28 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 44423 invoked by uid 99); 24 Aug 2007 09:26:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Aug 2007 02:26:28 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of rickmcg@gmail.com designates 66.249.82.239 as permitted sender) Received: from [66.249.82.239] (HELO wx-out-0506.google.com) (66.249.82.239) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Aug 2007 09:26:21 +0000 Received: by wx-out-0506.google.com with SMTP id i27so652860wxd for ; Fri, 24 Aug 2007 02:26:01 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:reply-to:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=MxMDyjdhTET2swpa8Y8f5VJlIHME6aSbrFTV8kwl06K1TZle7Vg91iSkgMcWpfohBOrisPkXPw9BC0BnmFCSA/77awkpMmbro7vxpKwIepg/az3wqf5krHkJnqcEO02zUwP0yWpl9c7zIuiVvYsc/d7yd9/9THzSFmS3FpySnIo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:reply-to:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; b=CxwDY/xabfc9SJxkwXISMMf/sFTZK+/kHmwkDHaf16dJeiOXLv4ssnugVlB5N7uiVIrki1coupsb8Qt+CuRhvu6YSkaAJ63/gmTDHjXwXh+BPLTJ0aqiiTqDMraj/+JSOoFXvhYAlK9YN60y3ceHxJdLcztcl9UAFeB81OCb56c= Received: by 10.70.29.14 with SMTP id c14mr4722871wxc.1187947561120; Fri, 24 Aug 2007 02:26:01 -0700 (PDT) Received: from ?192.168.1.100? ( [68.191.49.248]) by mx.google.com with ESMTPS id h15sm4059789wxd.2007.08.24.02.25.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 24 Aug 2007 02:25:59 -0700 (PDT) Message-ID: <46CEA4FB.7020201@gmail.com> Date: Fri, 24 Aug 2007 05:29:31 -0400 From: Rick McGuire Reply-To: rickmcg@gmail.com User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: user@geronimo.apache.org Subject: Re: Geronimo 1.1.1's Javamail does not work for some SMTP server with more than 1 beginning lines References: <12232240.post@talk.nabble.com> <46CAC3EA.8020701@gmail.com> <12267277.post@talk.nabble.com> <46CC45B1.8020500@gmail.com> <12286630.post@talk.nabble.com> <46CD5A06.5040505@gmail.com> <12305401.post@talk.nabble.com> In-Reply-To: <12305401.post@talk.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Chua Chee Seng wrote: > Hi Rick, > > It works! Thank you very much. :-) > > If you don't mind, I am curious about the rule '220-' indicating there is > continuous line and '220' indicating it does not have continuous line, is > this rule in the SMTP specification? > Yes, this is part of the SMTP specification, although only place I'd encountered a continuation response was the EHLO command. I might want to generalize the receiving of the response lines to automatically account for continuatations....I'm now nervous that there might be other places where this might show up. Rick > Once again, thank you for your help. > > Regards, > Chee Seng > > > > Rick McGuire wrote: > >> Your analysis is exactly correct, it was a silly mistake on my part >> (sigh). I'm glad I asked you to check it out before I committed the >> change! Anyway, I've refreshed the jar file out on people.apache.org, >> so if you would give the new version a try, I'd really appreciate it. >> >> Rick >> >> Chua Chee Seng wrote: >> >>> Hi Rick, >>> >>> It does not work. When executed, the debugging console is showing these >>> lines:- >>> >>> 220-xxx.xxx.xxx ESMTP Exim x.xx #1 Mon, 20 Aug 2007 16:29:11 +0800 >>> 220-We do not authorize the use of this system to transport unsolicted, >>> 220 and/or bulk email. >>> >>> It then stopped there until a Read timed out exception is thrown. Seems >>> to >>> me that the client is not sending EHLO/HELO to the server. >>> >>> I decompiled SMTPTransport and SMTPReply (I don't have the modified >>> source >>> code) to see what can be wrong, I think getWelcome() method in >>> SMTPTransport >>> is causing the problem:- >>> >>> protected boolean getWelcome() >>> throws MessagingException >>> { >>> SMTPReply line = getReply(); >>> if(line.isError()) >>> return false; >>> for(; line.isContinued(); getReply()); >>> return true; >>> } >>> >>> In the for loop, the line.isContinued() is always returning false as it >>> does >>> not get setting to new reference to SMTPReply returned by getReply() call >>> in >>> the for loop. I think something like the following should work:- >>> >>> protected boolean getWelcome() >>> throws MessagingException >>> { >>> SMTPReply line = getReply(); >>> if(line.isError()) >>> return false; >>> >>> while(line.isContinued()) >>> line = getReply(); >>> >>> return true; >>> } >>> >>> As it is decompiled code, I am not sure if your source code is like the >>> above, so it is just my guess. I would be happy to help to test again >>> with >>> new builds. :-) >>> >>> Best Regards, >>> Chee Seng >>> >>> >>> Rick McGuire wrote: >>> >>> >>>> Chua Chee Seng wrote: >>>> >>>> >>>>> Hi Rick, >>>>> >>>>> Thanks for the reply. I would be happy to help out testing it. >>>>> However, >>>>> I >>>>> am very new to this community and some guidance is really appreciated. >>>>> :-) >>>>> >>>>> >>>>> >>>> This should be fairly simple. I built a 1.1.1 version of SMTP code and >>>> placed it here: >>>> >>>> http://people.apache.org/~rickmcguire/stage-javamail/geronimo-javamail-transport-1.1.1.jar >>>> >>>> Just replace the geronimo-javamail-transport jar file in your 1.1.1 >>>> server assembly, and retry your program. That will verify that my fix >>>> is working correctly and I'll be able to commit my fix for the problem. >>>> Unfortunately, the fix won't ship until the next Geronimo update, but >>>> you'll have a corrected jar to run with while you're on 1.1.1. >>>> >>>> Rick >>>> >>>> >>>> >>>> >>>>> Regards, >>>>> Chee Seng >>>>> >>>>> >>>>> >>>>> Rick McGuire wrote: >>>>> >>>>> >>>>> >>>>>> This is the first time I've encountered an SMTP server that sends a >>>>>> response back like this. I've opened a JIRA for this issue: >>>>>> >>>>>> https://issues.apache.org/jira/browse/GERONIMO-3427 >>>>>> >>>>>> and I'll take a look at fixing this. Since I don't have access to an >>>>>> SMTP server that behaves this way, are you willing/able to help try >>>>>> out >>>>>> potential fixes? >>>>>> >>>>>> Rick >>>>>> >>>>>> Chua Chee Seng wrote: >>>>>> >>>>>> >>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> I am trying to use the Geronimo Javamail. I have setup the resource >>>>>>> and >>>>>>> resource-ref stuff and try to send a mail from the application. I >>>>>>> turn >>>>>>> off >>>>>>> the debug flag and see the following in the console:- >>>>>>> >>>>>>> ... >>>>>>> 220-xxx.xxx.xxx ESMTP Exim x.xx #1 Mon, 20 Aug 2007 16:29:11 +0800 >>>>>>> EHLO xxxxx >>>>>>> 220-We do not authorize the use of this system to transport >>>>>>> unsolicted, >>>>>>> HELO xxxxx >>>>>>> 220 and/or bulk email. >>>>>>> ... >>>>>>> >>>>>>> An exception is then thrown complaining that it fails to send HELO to >>>>>>> the >>>>>>> server. >>>>>>> >>>>>>> When using telnet xxxx 25 to my SMTP server, I found out that once >>>>>>> connected, the SMTP is sending back three lines of text:- >>>>>>> 220-xxx.xxx.xxx ESMTP Exim x.xx #1 Mon, 20 Aug 2007 16:29:11 +0800 >>>>>>> 220-We do not authorize the use of this system to transport >>>>>>> unsolicted, >>>>>>> 220 and/or bulk email. >>>>>>> >>>>>>> I then try with a local SMTP using Apache JAMES, which successfully >>>>>>> send >>>>>>> the >>>>>>> mail. When I try to telnet localhost 25, it is sending back only one >>>>>>> line >>>>>>> of text:- >>>>>>> >>>>>>> 220 xxxx SMTP Server (JAMES SMTP Server 2.3.1) ready Mon, 20 Aug 2007 >>>>>>> 16:32:26 +0800 (SGT) >>>>>>> >>>>>>> I am suspecting Geronimo Javamail implementation (version 1.1.1) >>>>>>> cannot >>>>>>> be >>>>>>> used on SMTP who sends back more than 1 lines of 220 service ready. >>>>>>> I >>>>>>> investigate the source code of >>>>>>> org.apache.geronimo.javamail.transport.smtp.SMTPTransport and study >>>>>>> that >>>>>>> getReply() method is using the receiveLine() method to read response >>>>>>> from >>>>>>> the server. As receivedLine() is using end of stream (read() ==-1) >>>>>>> or >>>>>>> CR >>>>>>> or >>>>>>> LF to indicate end of response from server, so in the above scenario >>>>>>> each >>>>>>> 220 are identified as a response from the server. After receiving >>>>>>> the >>>>>>> first >>>>>>> 220, the client send a EHLO but fails as the server is sending back >>>>>>> the >>>>>>> 2nd >>>>>>> 220. The client then try to send a HELO but receive the 3rd 220, >>>>>>> which >>>>>>> it >>>>>>> finally gave up and throw a fails to send HELO exception. >>>>>>> >>>>>>> I have switch to Sun Javamail implementation to solve the problem. >>>>>>> However, >>>>>>> I personally prefer to use Geronimo implementation due to >>>>>>> installation >>>>>>> issue. Is there a better way, or is it in the later version >>>>>>> (Geronimo >>>>>>> 1.2, >>>>>>> 2.0, I didn't try :P), the Geronimo Javamail can handle SMTP that >>>>>>> sends >>>>>>> more than 1 lines of 220 back to client (like the SMTP server that I >>>>>>> am >>>>>>> facing)? >>>>>>> >>>>>>> Thanks in advance for any advice. >>>>>>> >>>>>>> Best Regards, >>>>>>> Chee Seng >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > >