You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Patrick <pa...@gmail.com> on 2010/04/14 20:39:22 UTC

how i fixed my email html problem

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.