Re: JavaMail bug?
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.