James 2.2.0, Phoenix 4.0.1
In a mailet that extends GenericMailet, in the service method, I have the
following:
...
MimeMessage msg = newMail.getMessage( );
if ( msg.getContent( ) instanceof Multipart) {
Multipart mpart = (Multipart) msg.getContent( );
for (int ix=0, iNumParts=mpart.getCount(); ix < iNumParts; ix++) {
BodyPart part = mpart.getBodyPart( ix );
if (part.getContentType( ).startsWith( "text/html" )) {
String htmlString = generatePartContent( ... ); // a
function that produces html text
log( "before setContent: part.getContentType() = "
+part.getContentType( ) ); // text/html;... here
part.setContent( htmlString, part.getContentType() );
log( "after setContent: part.getContentType() = "
+part.getContentType( ) ); // text/plain here
...
before the part.setContent statement, the part's content type is reported as :
text/html;
charset="iso-8859-1"
after the setContent call, it is reported as "text/plain"
I seem to have lost both the "html" as well as the charset information.
Bizarre, no? Anyone have similar experience???
-- Craig Harris
[EMAIL PROTECTED]