james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Danny Angus" <da...@thought.co.uk>
Subject RE: Mailet
Date Tue, 16 Oct 2001 09:42:09 GMT
correct me if I'm wrong Oki, but does your attachement work by writing all
the headers, then the body into a file the reading it into a body part?

If so you might be interested in this code snippet ...


	  MimeMultipart multipart = new MimeMultipart();
        MimeBodyPart part = new MimeBodyPart();
	  MimeMessage message = mail.getMessage();

	  part = new MimeBodyPart();
        part.setContent("Helo Oki, mail attached", "text/plain");
        multipart.addBodyPart(part);

        part = new MimeBodyPart();
        part.setContent(message, "message/rfc822");
        multipart.addBodyPart(part);

// assuming you've already got a MimeMessage called reply ready with
recipients etc..

        reply.setContent(multipart);
        reply.setHeader("Content-Type", multipart.getContentType());


which creates a multipart MimeMessage with another MimeMessage as the
attachment.

the key is: part.setContent(message, "message/rfc822");

This can nest forever, which might be a problem if mail to the postmaster
bounced  ~:-o, but is otherwise quite a cool thing, as the attached message
will contain all its multipart/alternative versions, its headers, and its
attachments.

d.

> -----Original Message-----
> From: Oki DZ [mailto:okidz@pindad.com]
> Sent: Tuesday, October 16, 2001 8:02 AM
> To: james-dev@jakarta.apache.org
> Subject: Mailet
>
>
> Hi,
>
> I'd like to contribute this mailet; a mailet for forwarding messages to
> other destinations. It works just like Forward mailet, but has some
> additional elements in the mailet config; such as setting the subject
> line. But it forwards the messages as attachments; so that the postmasters
> would have a chance to add some notice in the messages.
>
> I tested it using Pine, so it is Pine-friendly.
>
> Oki
>
>
>
>


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


Mime
View raw message