Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Nigel Wade Newsgroups: comp.lang.java.programmer Subject: Re: JavaMail bug? Date: Tue, 02 Aug 2011 16:34:20 +0100 Lines: 47 Message-ID: <99qjntFk6uU1@mid.individual.net> References: <995djcFq0nU1@mid.individual.net> <99njvpFv11U1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 2H7JjsLAyvYtpNmYYBbfowoIPOdYvN2ZGf3m9eaHOgfF08atek Cancel-Lock: sha1:DF/HxtdeDJOe5EkuXYkYPxVH5IQ= 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: Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6750 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