To send HTML mail, you need to use a multipart body. Here's a very nice article on how to do this: http://java.sun.com/developer/EJTechTips/2004/tt0426.html Rick SHAW, Thomas wrote: > > Hi Guys, > > I am having problems sending html emails from a geronimo server. When > my code runs on the J2EE preview server in eclipse everything works > fine. Is there anything i need to configure on the server to assist > the sending of these emails? > > The email arrives in my inbox as text format not html > > Can anybody explain what i am doing wrong? > > Here is a clip of the code: > > Message_ msg_ = new MimeMessage(session); > > _ msg_.setFrom(new InternetAddress(from)); > _ msg_.setRecipients(Message.RecipientType.TO, > InternetAddress.parse( > to, false)); > _ msg_.setSubject(subject); > _ msg_.setContent(body, "text/_html_"); > > //StringBuffer_ sbuf_ = new StringBuffer(body); > //_msg_.setContent(new > String(_sbuf_.toString().getBytes(), "_iso_-8859-1"), "text/_html_;_ > charset_=\"_iso_-8859-1\""); > > //_msg_.setHeader("Content-Transfer-Encoding", "7bit"); > > msg.setSentDate(new Date()); > Transport.send(_msg_); > > > This is the content of the email when it arrives as text: > > MIME-Version: 1.0 > Content-Type: text/html; charset=iso-8859-1 > Content-Transfer-Encoding: quoted-printable > > Transitional//EN"><= > meta http-equiv=3D"Content-Type" content=3D"text/html; > charset=3DISO-8859-1"= > />GEQ004A_quote_1207.html<%@ include > view=3D"gl= > adiator_mirror_page_left" %> cellspacing=3D= > "0" cellpadding=3D"0">
bgcolor=3D"#= > 009933"> width=3D= > "50" bgcolor=3D"#009933">
valign=3D"top"> th=3D"200" border=3D"0" cellspacing=3D"0" cellpadding=3D"0"> > = >
src=3D"http= > ://localhost/GladQE/pages/gladiator/emails/GEQ004A/gc_home_pic_top_0806.jpg"= > > > Thanks for your time > > Tom > > ****** 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. > ________________________________________________________________________