File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes Help me please, JavaMail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Help me please, JavaMail" Watch "Help me please, JavaMail" New topic

Help me please, JavaMail

Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3479

Hi guys.
I have wrote a simple Java class to send an email to ""
address from the "" adress.

but I have got the following exceptions :
MessagingException : could not connect to SMTP host, port 25
nested exception is : SocketException : Network is unreachable
so, is property refers to the reciever host or to sender host ??
is every smtp mail server has the following format :
like : or ??
please, I need help, because JavaMail is a vital subject me....
Peter KelleyNH

Joined: Jan 21, 2004
Posts: 1
SMTP name is for the Send Mail Transport Protocol** -- It's the name of a host that will send your message. Take a peek in your regular email program options and you'll probably see the info you need to plug. If that doesn't help perhaps you could discuss with a network admin or whoever set up your email for the correct SMTP (aka SendMail) address.
** exact acronym I'm not sure -- could be Send Mail Transport Program but you get the idea. PKNH

Pete K. NH [SCJP]
Hanna Habashy
Ranch Hand

Joined: Aug 20, 2003
Posts: 532
Hi John:
I just have a question for you. Why are you using Session.getDefaultInstance() method as oppose to Session.getInstance(). When you use getDefualtInstance it return a Session object that is shared among all application running in the same JVM. Isn't a security hole? for example, if another application reset the security parameters on the defualt Session instance, then your application will not be able to access it anymore.
I am not criticising your choice, I just want to know why?

SCJD 1.4<br />SCJP 1.4<br />-----------------------------------<br />"With regard to excellence, it is not enough to know, but we must try to have and use it.<br />" Aristotle
eammon bannon
Ranch Hand

Joined: Mar 16, 2004
Posts: 140

SMTP name is for the Send Mail Transport Protocol
exact acronym I'm not sure -- could be Send Mail Transport Program but you get the idea. PKNH

*Ahem* - its actually Simple Mail Transfer Protocol (See RFC 821 which defines it). I could also point out its not an acronym, but I might get thrown out of the forum for being far too smug...
I agree. Here's the link:
subject: Help me please, JavaMail
jQuery in Action, 3rd edition