Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #6771

Re: JavaMail bug?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Nigel Wade <nmw-news@ion.le.ac.uk>
Newsgroups comp.lang.java.programmer
Subject Re: JavaMail bug?
Date Wed, 03 Aug 2011 09:27:43 +0100
Lines 123
Message-ID <99sf3vFncoU1@mid.individual.net> (permalink)
References <j0fb5e$sat$1@localhost.localdomain> <995djcFq0nU1@mid.individual.net> <j0khlj$8bg$3@localhost.localdomain> <j0kilj$8bg$4@localhost.localdomain> <j0v8t7$os9$1@localhost.localdomain> <99njvpFv11U1@mid.individual.net> <j1771e$smf$1@localhost.localdomain> <99qjntFk6uU1@mid.individual.net> <j19l2v$h45$1@localhost.localdomain>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net xsIaxqYqQPNU3TGh8plgpQbjNaTCrwzfS6OZo//0DPY86no6Cf
Cancel-Lock sha1:cZlPQ2cJab2AUOg0tdfuQgNwsWk=
User-Agent Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.2.18) Gecko/20110616 SUSE/3.1.11 Thunderbird/3.1.11
In-Reply-To <j19l2v$h45$1@localhost.localdomain>
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6771

Show key headers only | View raw


On 02/08/11 21:01, Martin Gregorie wrote:
> On Tue, 02 Aug 2011 16:34:20 +0100, Nigel Wade wrote:
>
>>> What does my SSCE do in your environment?
>>
>> I get:
>>
>> javax.mail.MessagingException: Unknown SMTP host: zoogz.gregorie.org;
>>     nested exception is:
>>           java.net.UnknownHostException: zoogz.gregorie.org
>>
>> I presume your DNS does not propagate upward from your zone.
>>
> Correct. Its definitive only within my LAN and my firewall refused all
> connections from outside.
>
>> But it /is/ attempting to resolve that hostname via our DNS servers.
>> It's not using localhost.
>>
> Interesting. I wonder why we're seeing a difference.
> I assume you ran it with no command line arguments except (possibly)
> 'debug'.

I doubt it would help. Since the host doesn't resolve, there's really 
nothing to debug. It can't connect to anything because it has no IP for 
the connect.

>
> When I do that the debugging text says that it was trying to connect to
> zoogz.gregorie.org.  Lines 7 and 8 show the first 220 followed a DEBUG
> line reporting this. Then lines 31 and 32 report a failure to connect to
> localhost and the resulting exception. If you're following this with
> Wireshark I'd expect you to see the first connect attempt but maybe not
> the second. Here's the debugging output:
>
> $ java MATestMail debug
> DEBUG: setDebug: JavaMail version 1.4.4
> DEBUG: getProvider() returning javax.mail.Provider
> [TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
> DEBUG SMTP: useEhlo true, useAuth false
> DEBUG SMTP: trying to connect to host "zoogz.gregorie.org", port 25, isSSL
> false
> 220 zoogz.gregorie.org ESMTP Postfix
> DEBUG SMTP: connected to host "zoogz.gregorie.org", port: 25

Here, you have connected to your mail server zoogz.gregorie.org

>
> EHLO zappa.gregorie.org
> 250-zoogz.gregorie.org
> 250-PIPELINING
> 250-SIZE 51200000
> 250-VRFY
> 250-ETRN
> 250-ENHANCEDSTATUSCODES
> 250-8BITMIME
> 250 DSN

and received the standard mail server 250 connection response.

Note that it does not include AUTH, so no authentication will be allowed 
and the client should not attempt it.

> DEBUG SMTP: Found extension "PIPELINING", arg ""
> DEBUG SMTP: Found extension "SIZE", arg "51200000"
> DEBUG SMTP: Found extension "VRFY", arg ""

This isn't a good idea. It's an open invitation to spammers to verify 
the existence of every recipient in your domain.

> DEBUG SMTP: Found extension "ETRN", arg ""
> DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
> DEBUG SMTP: Found extension "8BITMIME", arg ""
> DEBUG SMTP: Found extension "DSN", arg ""
> smtp://kiwi@zoogz.gregorie.org
> smtp://kiwi@zoogz.gregorie.org
> DEBUG: getProvider() returning javax.mail.Provider
> [TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
> DEBUG SMTP: useEhlo true, useAuth false
> DEBUG SMTP: trying to connect to host "localhost", port 25, isSSL false

I presume that this is due to the fact that the connect() above failed. 
You have specified authentication by using a user/password, but the 
connection does not allow authentication. When you subsequently use 
tr.send() there is no open session so a default session is created which 
appears to be to localhost.

> javax.mail.MessagingException: Could not connect to SMTP host: localhost,
> port: 25;
>    nested exception is:
> 	java.net.ConnectException: Connection refused
> 	at com.sun.mail.smtp.SMTPTransport.openServer
> (SMTPTransport.java:1934)
> 	at com.sun.mail.smtp.SMTPTransport.protocolConnect
> (SMTPTransport.java:638)
> 	at javax.mail.Service.connect(Service.java:295)
> 	at javax.mail.Service.connect(Service.java:176)
> 	at javax.mail.Service.connect(Service.java:125)
> 	at javax.mail.Transport.send0(Transport.java:194)
> 	at javax.mail.Transport.send(Transport.java:124)
> 	at MATestMail.main(MATestMail.java:59)
> Caused by: java.net.ConnectException: Connection refused
> 	at java.net.PlainSocketImpl.socketConnect(Native Method)
> 	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
> 	at java.net.PlainSocketImpl.connectToAddress
> (PlainSocketImpl.java:213)
> 	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
> 	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
> 	at java.net.Socket.connect(Socket.java:529)
> 	at java.net.Socket.connect(Socket.java:478)
> 	at com.sun.mail.util.SocketFetcher.createSocket
> (SocketFetcher.java:288)
> 	at com.sun.mail.util.SocketFetcher.getSocket
> (SocketFetcher.java:231)
> 	at com.sun.mail.smtp.SMTPTransport.openServer
> (SMTPTransport.java:1900)
> 	... 7 more
>
> At this point I really am going to drop off the net for a few days - got
> a 5AM start tomorrow.
>
>

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

JavaMail bug? Martin Gregorie <martin@address-in-sig.invalid> - 2011-07-23 20:32 +0000
  Re: JavaMail bug? Knute Johnson <september@knutejohnson.com> - 2011-07-23 20:54 -0700
    Re: JavaMail bug? Martin Gregorie <martin@address-in-sig.invalid> - 2011-07-24 09:50 +0000
      Re: JavaMail bug? Knute Johnson <september@knutejohnson.com> - 2011-07-24 09:27 -0700
        Re: JavaMail bug? Martin Gregorie <martin@address-in-sig.invalid> - 2011-07-25 19:36 +0000
          Re: JavaMail bug? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2011-07-25 23:00 -0700
            Re: JavaMail bug? Steve Sobol <sjsobol@JustThe.net> - 2011-07-25 23:18 -0700
              Re: JavaMail bug? Martin Gregorie <martin@address-in-sig.invalid> - 2011-07-26 17:49 +0000
            Re: JavaMail bug? Martin Gregorie <martin@address-in-sig.invalid> - 2011-07-26 17:42 +0000
  Re: JavaMail bug? Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-07-25 15:40 +0100
    Re: JavaMail bug? Martin Gregorie <martin@address-in-sig.invalid> - 2011-07-25 19:54 +0000
      Re: JavaMail bug? Martin Gregorie <martin@address-in-sig.invalid> - 2011-07-25 20:11 +0000
        Re: JavaMail bug? Martin Gregorie <martin@address-in-sig.invalid> - 2011-07-29 21:32 +0000
          Re: JavaMail bug? Knute Johnson <september@knutejohnson.com> - 2011-07-29 16:26 -0700
          Re: JavaMail bug? Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-08-01 13:20 +0100
            Re: JavaMail bug? Martin Gregorie <martin@address-in-sig.invalid> - 2011-08-01 21:49 +0000
              Re: JavaMail bug? Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-08-02 16:34 +0100
                Re: JavaMail bug? Martin Gregorie <martin@address-in-sig.invalid> - 2011-08-02 20:01 +0000
                Re: JavaMail bug? Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-08-03 09:27 +0100
                Re: JavaMail bug? Martin Gregorie <martin@address-in-sig.invalid> - 2011-08-08 22:50 +0000
                Re: JavaMail bug? Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-08-09 13:31 +0100
                Re: JavaMail bug? Martin Gregorie <martin@address-in-sig.invalid> - 2011-08-09 22:47 +0000
                Re: JavaMail bug? Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-08-10 09:34 +0100
                Re: JavaMail bug? Martin Gregorie <martin@address-in-sig.invalid> - 2011-08-10 19:37 +0000
                Re: JavaMail bug? Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-08-03 09:38 +0100
                Re: JavaMail bug? Martin Gregorie <martin@address-in-sig.invalid> - 2011-08-16 21:06 +0000
                Re: JavaMail bug? Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-08-17 10:29 +0100
                Re: JavaMail bug? Martin Gregorie <martin@address-in-sig.invalid> - 2011-08-17 19:54 +0000
                Re: JavaMail bug? Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-08-18 09:34 +0100
                Re: JavaMail bug? Martin Gregorie <martin@address-in-sig.invalid> - 2011-08-18 19:50 +0000
          Re: JavaMail bug? Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-08-01 12:54 +0000

csiph-web