Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!usenet.ukfsn.org!not-for-mail From: Martin Gregorie Newsgroups: comp.lang.java.programmer Subject: JavaMail bug? Date: Sat, 23 Jul 2011 20:32:46 +0000 (UTC) Organization: UK Free Software Network Lines: 43 Message-ID: NNTP-Posting-Host: 84.45.235.129 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: localhost.localdomain 1311453166 29021 84.45.235.129 (23 Jul 2011 20:32:46 GMT) X-Complaints-To: usenet@localhost.localdomain NNTP-Posting-Date: Sat, 23 Jul 2011 20:32:46 +0000 (UTC) User-Agent: Pan/0.133 (House of Butterflies) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6478 I seem to have found a JavaMail-1.4.4 bug If I try to open an SMTP connection by obtaining a transport instance and then calling connect(): Transport tr = sesh.getTransport("smtp"); tr.connect(host, user, password); where: sesh is the current mail session, host is "zoogz.gregorie.org" user is "kiwi" and password is a valid password for the user Transport.connect() sets up the URLName "smtp://kiwi@zoogz.gregorie.org", which is what I expect, but then promptly fails with: javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25; nested exception is: java.net.ConnectException: Connection refused when the local Postfix MTA on the machine I'm connecting from (zappa.gregorie.org) is stopped. If I restart the local Postfix instance the connect request succeeds and the mail message is sent, but its headers clearly show that JavaMail delivered it to the local MTA, which then passed it to the Postfix MTA on zoogz.gregorie.org, which has been listening on port 25 the whole time. IOW the Transport.connect(host,user,password) method sets up its target URL as expected but then promptly ignores it and defaults to connecting to localhost on port 25. Have any of you seen this problem? Have I done anything stupid? Is there a workround? -- martin@ | Martin Gregorie gregorie. | Essex, UK org |