JAVAMAIL FORMAT/SORT EMAILED FIELDS
Hi,
I am suing the following code to send variable numbers of fields from a form. The strings are sent correctly but in the wrong order - how do I get them to list as the original form. Also how do I send HTML formatting in the email (e.g.
's):
At the moment I get something like:
Some text!!!
adrian@protocolwebdesign.com
2
?br>
1
BOOK ORDER
?br>Send Order
Mr
Some text!!!
?br>Mastercard
06
01
Wanting to get something like:
EMail:adrian@protocolwebdesign.com
Book1: bookname1
Book2: bookname 2
Card Type: Mastercardetc....
CODE IS:
Properties props = new Properties();
props.put("mail.countrychoicecookers.com", "mail.wanadoo.co.uk");
Session s = Session.getInstance(props,null);
MimeMessage message = new MimeMessage(s);
InternetAddress from = new InternetAddress("info@countrychoicecookers.com");
message.setFrom(from);
String toAddress = request.getParameter("to");
InternetAddress to = new InternetAddress(toAddress);
message.addRecipient(Message.RecipientType.TO, to);
String subject = request.getParameter("subject");
message.setSubject(subject);
String text = request.getParameter("text");
Enumeration paramNames = request.getParameterNames();
while(paramNames.hasMoreElements()) {
String paramName = (String)paramNames.nextElement();
out.println("Parameter Name:" + paramName + "
");
String[] paramValues = request.getParameterValues(paramName);
out.println("Value:"+paramValues+"
");
for(int i=0; i < paramValues.length; i++){
text+="
";
text+=paramValues ;
}
}
message.setText(text);
Transport.send(message);
NOTE: THERE IS A [ i ] after text+=paramValues above - for some bizarre reason it dissapears when i preview this message!!!

