• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I email html form parameter values?

 
Stephen Batsas
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:
Address:
Phone:
Email:
Fax:
Comment:
Steer me in the right direction Ranchers.
Regards
Stephen Batsas
SCPJ2
 
Gaja Venkat
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi:
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 http://java.sun.com/products/javamail/index.html . 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.
Regards
Stephen Batsas
SCJP2
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic