how i fixed my email html problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

how i fixed my email html problem

Patrick-4
I don't really know how it works, but this is what I did

ByteArrayInputStream byter = new ByteArrayInputStream(body.getBytes());
mail = new MimeMessage(session, byter);   //this is a change, the
EmailServices.java code uses this constructor MimeMessage(session)
with one 1 arg
mail.addHeaderLine("Content-Type: text/html; charset=UTF-8"); //this
new constructor defaults to text/plain so you have to feed it
text/html here

//then later I turned off this
/*
mail.setText(body, "UTF-8", "html"); // third arg is actually
contentType.subString something or other
mail.saveChanges();  //this was mangling my chars :(
*/

since I'm thrilled about this, I thought I'd share
I'm on 64bits, I wonder if that makes a difference.