You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by JJ <uk...@yahoo.com> on 2003/12/04 04:59:45 UTC

Adding HTML to the beginning of all messages passing through James

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: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


RE: Adding HTML to the beginning of all messages passing through James

Posted by "Noel J. Bergman" <no...@devtech.com>.
> 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

See the AddFooter mailet.

	--- Noel

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org