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


Trader Joey
Ranch Hand

Joined: May 11, 2000
Posts: 33
Can you tell me the requirements for running a sample javamail program to send a mail thru an application ? Can i send a mail thru my application using my hotmail smtp server ot any other smtp server ?
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
These days, the recommended way is to use the JavaMail API.
It's a bit fiddly to set up (you have to add two new jar files
to your classpath) but once installed, it works really well.
1. Get JavaMail ("mail.jar") and the Java Activation Framework("activation.jar") from
2. Add these two jar files to your classpath (this may be as easy as adding them to the jre/lib/ext directory in Java 2).
3. Add the following class to your project as "":

4. Examine it, modify it, play with it, have fun.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Duane White

Joined: Aug 29, 2003
Posts: 1
How would you use this same process and format the email mesage in html format?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

Sounds to me like you could use this.
Might save you some time.

GenRocket - Experts at Building Test Data
I agree. Here's the link:
subject: JAVA MAIL
jQuery in Action, 3rd edition