Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

How do I email html form parameter values?

Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Ranchers,
I have created a HTML Form - Text fields,text area and submit button for Person name and address/Email etc. I call a JSP page(or a servlet)to process the form parameters into a message format. I can redirect to another page or output to a new html page. I actually want to forward the messaage to an email address so that the receipient gets the details in the formatted version. eg.
Date of Message:
Full Name:
Steer me in the right direction Ranchers.
Stephen Batsas
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One solution for emailing HTML forms is to use Java Mail. For this two jar files are required - one named mail.jar from java mail and another named activation.jar from Java Activation Framework(JAF). These two can be downloaded from . More information can be obtained by following FAQ link of this page.
After proper installtion, you can display the html form using JSP and use Java Bean to extract the form fields. Then you may write another JSP for sending the mail. This JSP should ideally be doing the following:
1) Get the values of the form fields using the same Java Bean (discussed above)
2) Create a new session for sending mail
3) Create a new message and set the values for relevant fields such as To, From etc., and format the message body using the setText method.
4) Send the message
Many links to articles on using Java Mail are available on the same url given in first paragraph.
Hope this is helpful.
Gaja Venkat
Sun Certified Programmer for Java 2 Platform
[ March 19, 2002: Message edited by: Gaja Venkat ]
Stephen Batsas
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for that.
I will follow the link.
Stephen Batsas
"How many licks ..." - I think all of this dog's research starts with these words. Tasty tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic