This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes Javamail behind proxy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Javamail behind proxy" Watch "Javamail behind proxy" New topic
Author

Javamail behind proxy

Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1526
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)


Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Does your proxy server allow the relaying of SMTP? Its going to have to to use JavaMail, and most don't.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1526
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...
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

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).
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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.
 
Don't get me started about those stupid light bulbs.
 
subject: Javamail behind proxy
 
Similar Threads
simple javamail example getting error
Java Mail problem
Give me solution to send mail
Javamail error
Send Mail Error