Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

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:
Address:
Phone:
Email:
Fax:
Comment:
Steer me in the right direction Ranchers.
Regards
Stephen Batsas
SCPJ2
 
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
 
The world's cheapest jedi mind trick: "Aw c'mon, why not read this tiny ad?"
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic