Two Laptop Bag
The moose likes Servlets and the fly likes Send email directly from a servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Send email directly from a servlet" Watch "Send email directly from a servlet" New topic

Send email directly from a servlet

Regus Patoff

Joined: Oct 30, 2001
Posts: 8
I am processing form data and wish to send it as an email, but I DON'T want to have to go through Outlook Express or any other email process. Can Java format and send emails without help?
zb cong
Ranch Hand

Joined: Jan 14, 2002
Posts: 416
use javax.mail package
there are some jsp tags can do it too,but i don't know where to downloaded them.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Lots of good stuff here:

The first download button is for the API itself. The jar files you need to write JavaMail code with. ( no link, it's a button )

Just in front of that button, note the download link to glasgow. You also need this download.
( )

Third thing to note is the API docs.
( )

Last, there is a good document available as PDF that shows sample code. ( no link, it's the second download button )

download buttons are labelled "continue".
Ken Shamrock
Ranch Hand

Joined: Jan 23, 2002
Posts: 139
does JavaMail need use of smtp?

Thanks everyone who helped me
Malhar Barai
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
u can even use classes.
then u need not download JavaMail.
& its easy to code too..
good luck
Tony Alicea

Joined: Jan 30, 2000
Posts: 3226
I wrote what is possibly the simplest servlet email "app" which gathers a few fields of text from a form and sends it to a predetermined address.
Since it's simple, it may be good for study but unusable for "industrial" purposes:

Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
I agree. Here's the link:
subject: Send email directly from a servlet
It's not a secret anymore!