Re: JavaMail bug?
On 01/08/11 22:49, Martin Gregorie wrote:
On Mon, 01 Aug 2011 13:20:09 +0100, Nigel Wade wrote:
What does my code do if you run it exactly as is? Does it attempt to
connect to yahoo.com or our mail server (you won't actually be able to
connect, it's blocked on port 25)?
It fails connecting to your server.
Yes, well, that's what I said would happen.
So, where does THAT leave us?
With the fact that it /attempted/ to connect to our mail server - not
localhost, and not yahoo.com.
The only difference is that you call
getDefaultInstance(props) while I call getInstance(props) and, according
to the documentation, these should do exactly the same the first time
they're called.
I see the same behaviour with either getDefaultInstance() or
getInstance() - it connects to our mail server.
BTW, I added the single property setting line to my application code so
that it uses the same hostname for 'mail.smtp.host' as connect(host,
user, passwd) does. That code now connects directly to the expected
server.
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. But it /is/
attempting to resolve that hostname via our DNS servers. It's not using
localhost.
--
Nigel Wade