0

I am using the same code that is in here : How can I send an email by Java application using GMail, Yahoo, or Hotmail? for sending an email. Its calling the transport.connect(...) and never coming out of that method call. This is happening only when I am in my company network. When I run the same program from a different network its working fine.

I tried to do run it using both wired and wireless connection, but it didn't actually make any difference.

Any reason why it is not coming out of the transport.connect method...

Community
  • 1
  • 1
vjk
  • 2,163
  • 6
  • 28
  • 42

1 Answers1

1

Your company network has a firewall that blocks connection to Gmail on the port you have specified in your code.

MarioDS
  • 12,895
  • 15
  • 65
  • 121
  • can i connect to gmail on a different port – vjk Dec 13 '12 at 22:52
  • You have to look on their site and find out which ports they support. I don't know them by heart. But do note that your company's firewall may be a bit more advanced, so maybe it doesn't only block on ports but does packet inspection. Other network ACLs may be in effect. But unless your company is of a certain size, it is unlikely that they have much more than a basic firewall. – MarioDS Dec 13 '12 at 22:56
  • Note that the JavaMail FAQ has [tips for debugging connection problems](http://www.oracle.com/technetwork/java/javamail/faq/index.html#condebug). – Bill Shannon Dec 13 '12 at 23:25