geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "" <>
Subject Re: Sending HTML emails
Date Tue, 23 Jun 2009 03:30:24 GMT

You can use Multipart to set your content charset and your content transfer
encoding like below:

MimeMultipart multipart = new MimeMultipart();
        MimeBodyPart txtbodyPart = new MimeBodyPart();
        MimeBodyPart htmlodyPart = new MimeBodyPart();
        String htmlcontent = "html email ";
        htmlcontent = "<html><body>" + htmlcontent + "</body><html>";
        htmlodyPart.setContent(htmlcontent, "text/html;charset=GBK");
        htmlodyPart.setHeader("Content-Transfer-Encoding", "");
More details, you can refer to javamail

Good luck!

SHAW, Thomas wrote:
> Hi,
> I am trying send a HTML email from my java app running on geronimo.
> I create a MimeMessage (Message msg = new MimeMessage(session);) and set
> all the attributes including the body
> msg.setContent(body, "text/html");
> When this message is sent it arrives as a text email. this is the top of
> the email
> MIME-Version: 1.0
> Content-Type: text/html; charset=Cp1252
> Content-Transfer-Encoding: quoted-printable
> X-Mailer: GladiatorEmail
> <html><head><=
> meta http-equiv=3D"Content-Type" content=3D"text/html;
> charset=3DISO-8859-1"=
>  /><title>GEQ004A_quote_1207.html</title></head>
> 3D" seems to be appearing within in the document. I am not sure the
> charset is correct(cp1252) or how to change if it is not.
> Does anyone know how I fix this?
> Thanks
> 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, 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.
> ________________________________________________________________________

View this message in context:
Sent from the Apache Geronimo - Dev mailing list archive at

View raw message