File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Sending mails outside intranet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Sending mails outside intranet" Watch "Sending mails outside intranet" New topic

Sending mails outside intranet

Vinayak patil
Ranch Hand

Joined: Aug 30, 2005
Posts: 67

We are doing a project in which we need to send automated mails. We are using javax.mail API to send mails.

But we are able to send mails only within our institute intranet and not outside like yahoo, gmail Ids.

Please let me know how to send mails outside intranet.

Another group is doing the same feature in .NET. So it is not an issue with the SMTP server.

Thanks in advance,

"I can resist everything except temptation"
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3753

I'm going to go out on a limb and say your problem is not related java but your network setup. It may not have access to the internet, or more likely, blocks certain ports from being called remotely.

As long as your addressing the messages in the same manner such as versus, there's nothing that prevent it from being delivered.

[OCA 8 Book] [Blog]
Vinayak patil
Ranch Hand

Joined: Aug 30, 2005
Posts: 67
We are able to send mails outside using "OutLook Express".

Also another team is doing the same using .NET.

So I feel there is a way in Java to do the same, something we are unaware of.

This is the code we are using now :

Scott Johnson
Ranch Hand

Joined: Aug 24, 2005
Posts: 518
Verify the SMTP server name/ip and the key ("") in the properties object that you are passing to Session.getInstance is correct.

From the computer running the program, try connecting to the SMTP server on port 25 using telnet. If you can't connect then you have a networking issue.

If that doesn't fix the problem, what exception is being thrown?
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

I'm going to join Scott on that limb and suggest your problem is that the server won't relay e-mail messages from other computers. This is standard configuration for SMTP servers nowadays.

Probably those other systems can relay because they are authenticating themselves with the server. Your program may have to do the same. At any rate, the administrator of the SMTP server should be able to clear up any doubts you might have. Go and ask.
I agree. Here's the link:
subject: Sending mails outside intranet
It's not a secret anymore!