I am currently trying to write a Mailet to add a
text/html content-type BodyPart to the beginning of
all emails that pass through James, regardless of
whether they are multipart.

I have tried various approaches but all result in the
newly created multipart message content being
displayed incorrectly. What should the content-type of
the new message be: "multipart/mixed",
"multipart/alternative"?? Both of these don't seem to
work for me.

The body of my service method is as follows:

{
  MimeMessage message = mail.getMessage();
  Multipart multiPart = new MimeMultipart();

  BodyPart bodyPart = new MimeBodyPart();
  
  //HTML is a String reference to my html content
  bodyPart.setContent(HTML, "text/html");
  bodyPart.setHeader("Content-Type", "text/html");
  multiPart.addBodyPart(bodyPart);

  bodyPart = new MimeBodyPart();
  bodyPart.setDataHandler(message.getDataHandler());
  multiPart.addBodyPart(bodyPart);

  message.setContent(multiPart);
  message.setHeader("Content-Type",
"multipart/mixed");
}

Any help with this would be extremely welcome.

Thanks in advance,

Jonathan

  





__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

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

Reply via email to