Thanks Rick i will check this out now! -----Original Message----- From: Rick McGuire [mailto:rickmcg@gmail.com] Sent: 10 July 2009 10:53 To: user@geronimo.apache.org Subject: Re: Sending HTML emails in Geronimo 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 > >
<= > meta http-equiv=3D"Content-Type" content=3D"text/html; > charset=3DISO-8859-1"= > />