commons-user mailing list archives

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

Hi, 

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
doesnt. 

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

Beneath the code the email that comes through to outlook 2000 
Thanks 

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.setSentDate(new Date()); 
//msg.setHeader("Content-Transfer-Encoding", "7bit"); 

Transport.send(msg); 

Also Tried 

HtmlEmail email = new HtmlEmail(); 
email.setHostName(props.getProperty("mail.smtp.host")); 
email.addTo(to); 
email.setFrom(from); 
email.setSubject(subject); 
email.setHtmlMsg(body); 
email.send();*/ 


Result: 

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
view=3D"gl= 
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
wid= 
th=3D"200" border=3D"0" cellspacing=3D"0" cellpadding=3D"0"> <tr> = 
<td><a href=3D"http://www.gladiator.co.uk/?media=3Dqfuem"><img src=3D"http=

://localhost/GladQE/pages/gladiator/emails/GEQ004A/gc_home_pic_top_0806.jpg"= 
width=3D"171" height=3D"112" border=3D"0"></a></td> </tr> <tr>
= 
<td><a href=3D"http://www.gladiator.co.uk/?media=3Dqfuem"><img src=3D"h= 
ttp://localhost/GladQE/pages/gladiator/emails/GEQ004A/gc_home_pic_bot_0806.j= 


****** 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,
www.fsa.gov.uk/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
it.
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. ________________________________________________________________________
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message