[ 
https://issues.apache.org/jira/browse/JAMES-1433?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13439661#comment-13439661
 ] 

Idea Harness commented on JAMES-1433:
-------------------------------------

Eric,

There is definitely a bug in Geronimo JavaMail impl of MimeBodyPart.setText( 
(String text, String charset, String subtype) when subtype = "html" (Oracle's 
JavaMail impl handles it correctly). 

I looked at the link of test cases you attached and Googled some more on this 
issue and it *seems* that the preferred way to set any content (including 
ContentType="text/html") is through
DataHandlers and ByteArrayDataSource (INSTEAD OF using MimeBodyPart.setText( 
(String text, String charset, String subtype) ), with something like :

String textContent = "<html><head></head><body><div>Here we 
go</div></body></html>";
String mimeType = "text/html; charset=ISO-8859-1";

MimeBodyPart bodyPart = new MimeBodyPart(); 
bodyPart.setContent( textContent, mimeType );
bodyPart.setDataHandler( new DataHandler( new ByteArrayDataSource( textContent, 
mimeType ) ) );
...
... Omit code were mimeMessage contains bodyPart in its hierarchy, which is 
implied
...
mimeMessage.saveChanges()

After this code runs, bodyPart.getContentType() correctly returns "text/html; 
charset=ISO-8859-1" with Geronimo JavaMail.
So I'll just use this method of setting "text/html" content instead of 
setText() (although it would be nice if it were documented NOT to use setText() 
method since it's buggy :} ).

Regards,
IH
                
> Upgrade to geronimo-javamail_1.4 1.8.3 and exclude oracle mail
> --------------------------------------------------------------
>
>                 Key: JAMES-1433
>                 URL: https://issues.apache.org/jira/browse/JAMES-1433
>             Project: JAMES Server
>          Issue Type: Bug
>    Affects Versions: 3.0-beta5
>            Reporter: Eric Charles
>            Assignee: Eric Charles
>            Priority: Minor
>             Fix For: 3.0-beta5
>
>
> See JAMES-1431

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to