this is a JavaMail issue, nothing to do with James.

However, try 
 part.setContent( htmlString, "text/html" );

instead of
 part.setContent( htmlString, part.getContentType() );

which, in your example is equivalent to
 part.setContent( htmlString, "text/html;\n  charset=\"iso-8859-1\"");

and read the javadocs for Part, particularly the bit about appropriate
handlers being available.

I suspect that it is simply failing to recognise the type because you
are also mentioning the charset.

d.

On Thu, 17 Feb 2005 02:31:04 -0500, Craig Harris <[EMAIL PROTECTED]> wrote:
> 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]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to