I am using javamail and behind a proxy. The mail server, the proxy and the application all three are on same LAN. If I use outlook to talk to my mail server, it works fine... however with javamail, the following sample code throws exception...
nested exception is: javax.mail.MessagingException: Could not connect to SMTP host: <some ip here>, port: 25; nested exception is: java.net.SocketException: Software caused connection abort: connect at javax.mail.Transport.send0(Transport.java:219) at javax.mail.Transport.send(Transport.java:81) at SendApp.send(SendApp.java:28) at SendApp.main(SendApp.java:33)
Thanks paul. I see it this way, if my outlook express works fine, so should any other mail client, then why not it be my javamail application? Just disabled proxies from IE and outlook still works as is...
Be careful. If you are talking about Exchange servers, Outlook Express does not use SMTP to connect to them, it uses MAPI.
Just disabled proxies from IE and outlook still works as is
The connection setting in IE and the Services defined in Outlook Express are unrelated.
However, if you can connect to an SMTP server via a proxy using an MUA that is actually using SMTP as its connection protocol (phew!) then JavaMail should be able to connect too. How do you know that Outlook is using a proxy? Looking at my version of Outlook, I can only define a mail server, not a proxy (of course the mail server I define may actually be a proxy, but I can't tell that from Outlook).
Are you sure the proxy is responsible for preventing you from connecting to port 25 on the mail server? I ask because some virus-prevention products (McAfee for sure and probably others) will block any outbound access to port 25, to prevent your computer from being used as a spam source. You should be able to turn that off in the product's configuration if that is your problem.