commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "SHAW, Thomas" <>
Subject Trying to send HTML email but coming through as text email (GERONIMO ISSUE)
Date Thu, 09 Jul 2009 13:29:39 GMT


I am trying to send html emails from my application running on a geronimo server on windows
and using eclipse for development. 
When I run this code on the J2EE preview server it works but when i run it on Geronimo is

Here is the code that sends the email where i have added comments shows other code i have

Beneath the code the email that comes through to outlook 2000 

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)); 


StringBuffer sbuf = new StringBuffer(body); 

msg.setContent(new String(sbuf.toString().getBytes(), "iso-8859-1"), "text/html; charset=\"iso-8859-1\"");

msg.setSentDate(new Date()); 
//msg.setHeader("Content-Transfer-Encoding", "7bit"); 


Also Tried 

HtmlEmail email = new HtmlEmail(); 


MIME-Version: 1.0 
Content-Type: text/html; charset=iso-8859-1 
Content-Transfer-Encoding: quoted-printable 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><=

meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DISO-8859-1"= 
/><title>GEQ004A_quote_1207.html</title></head><body><%@ include
adiator_mirror_page_left" %><table width=3D"600" border=3D"0" cellspacing=3D= 
"0" cellpadding=3D"0"> <tr> <td width=3D"200" height=3D"10" bgcolor=3D"#= 
009933"></td> <td width=3D"350" bgcolor=3D"#009933"></td> <td width=3D=

"50" bgcolor=3D"#009933"></td> </tr> <tr> <td valign=3D"top"><table
th=3D"200" border=3D"0" cellspacing=3D"0" cellpadding=3D"0"> <tr> = 
<td><a href=3D""><img src=3D"http=

width=3D"171" height=3D"112" border=3D"0"></a></td> </tr> <tr>
<td><a href=3D""><img src=3D"h= 

****** This email is sent for and on behalf of  Admiral Group plc ******

Admiral Group plc is registered in England and Wales at Capital Tower, Greyfriars Road, Cardiff
CF10 3AZ (Reg. No. 03849958). EUI Limited (Reg No: 02686904) is a subsidiary of Admiral Group
plc and is authorised and regulated by the Financial Services Authority (Firm reference number:
309378). These details can be confirmed by visiting the Financial Services Authority's Register, EUI Limited acts for, and on behalf of, other regulated insurance
companies. Further details may be provided on request.

Any opinions expressed in this email are those of the individual and not necessarily the company.
This email and any files transmitted with it, including replies and forwarded copies (which
may contain alterations) subsequently transmitted from the Company, are confidential and solely
for the use of the intended recipient. It may contain material protected by attorney-client
privilege. If you are not the intended recipient or the person responsible for delivering
to the intended recipient, be advised that you have received this email in error and that
any use is strictly prohibited.

If you have received this email in error please notify the Information Security Officer by
telephone on +44 (0) 29 2043 4252. Please then delete this email and destroy any copies of
Security Warning: Please note that this email has been created in the knowledge that Internet
email is not a 100% secure communications medium.  We advise that you understand and accept
this lack of security when emailing us.
Viruses: Although we have taken steps to ensure that this email and any attachments are free
from any virus, we advise that in keeping with good computing practice the recipient should
ensure they are actually virus free.
We may monitor the content of emails sent and received via our network for viruses or unauthorised
use and for other lawful business purposes.

This e-mail has been scanned for all viruses by Messagelabs. The
service is powered by MessageLabs. ________________________________________________________________________
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message