Hi guys,
I am trying to send html emails using geronimo server. when the emails arrive at my inbox they are in plain text format and not html. I have tried excluding the gernonimo javamail classes without much luck. Here is the code I am using and a snapshot of the email that arrives. The comments in the code are where I have tried different things out. Hope someone can help.
Session session = Session.getDefaultInstance(props, null);
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(
to, false));
msg.setSubject(subject);
//StringBuffer sbuf = new StringBuffer(body);
//msg.setContent(new String(sbuf.toString().getBytes(), "iso-8859-1"), "text/html; charset=\"iso-8859-1\"");
msg.setContent(body, "text/html");
msg.setSentDate(new Date());
//msg.setHeader("Content-Transfer-Encoding", "7bit");
//msg.setHeader("Content-Type", "text/html");
msg.saveChanges();
Transport.send(msg);
Here is the email: Not sure why the some of the headers are appearing at the top of the mail. These headers also do not appear in the header information box visible through outlook.
MIME-Version: 1.0
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><title>GEQ004A_quote_1207.html</title></head><body><%@ include view="gladiator_mirror_page_left" %><table width="600" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="200" height="10" bgcolor="#009933"></td> <td width="350" bgcolor="#009933"></td> <td width="50" bgcolor="#009933"></td> </tr> <tr> <td valign="top"><table width="200" border="0" cellspacing="0"
Thanks for your help
Tom