E-mail all the contents on a form.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Cain_Ullah
Posted On:   Tuesday, March 20, 2001 10:36 AM

I am trying to send values in form objects to an e-mail address. I have passed the 'from', 'to' and 'subject' parameters from my orders page to my confirmation page. It sends the value from the drop down box 'MenDate' correctly. However I also want to send the contents of the other form objects. Being drop downs and text fields. I have used the code below with JMail on a JSP page. Can anyone help me? I tried copying and pasting the newMessage.setText line with a different parameter but it didn't work. I also want to display all the information on the confirmation page instead of the line Your Message was sent. Any ideas? I only downloaded JMail a few days ago and have two weeks to hand in    More>>

I am trying to send values in form objects to an e-mail address. I have
passed the 'from', 'to' and 'subject' parameters from my orders page to my
confirmation page. It sends the value from the drop down box 'MenDate'
correctly. However I also want to send the contents of the other form
objects. Being drop downs and text fields. I have used the code below with
JMail on a JSP page. Can anyone help me? I tried copying and pasting the
newMessage.setText line with a different parameter but it didn't work. I
also want to display all the information on the confirmation page instead of
the line Your Message was sent. Any ideas?

I only downloaded JMail a few days ago and have two weeks to hand in my
webpage for my degree.
Most Grateful
Cain
Cain@thevisionz.freeserve.co.uk


<%

try{
Properties props = new Properties();
Session sendMailSession;
Store store;
Transport transport;


sendMailSession = Session.getInstance(props, null);

props.put("mail.smtp.host", "smtp.freeserve.net");

Message newMessage = new MimeMessage(sendMailSession);
newMessage.setFrom(new InternetAddress(request.getParameter("from")));
newMessage.setRecipient(Message.RecipientType.TO, new
InternetAddress(request.getParameter("to")));
newMessage.setSubject(request.getParameter("subject"));
newMessage.setSentDate(new Date());
newMessage.setText(request.getParameter("MenDate"));

transport = sendMailSession.getTransport("smtp");
transport.send(newMessage);
%>

Your Message Was Sent


<%
}
catch(MessagingException m)
{
out.println(m.toString());
}
%>

   <<Less
About | Sitemap | Contact