Lindsay , The Forward mailet available in 2.2.0a* (I don't remember in 2.1.*) has a "passThrough" parameter (defaulting to false) that already does the "forwarding as a copy" you need, using the MailImpl.duplicate(String) method (have a look at AbstractRedirect.service(Mail), second command).
More precisely, in AbstractRedirect.service(Mail) the incoming mail object always gets duplicated, then if passThrough is true also the wrapped MimeMessage object gets properly duplicated. The duplicated mail is processed and resent (inserted into the root processor) to whatever destination, and at the end if passThrough is false the original mail is ghosted, otherwise continues flowing in the mailet pipeline. If you need to add extra functionality to Forward, why don't you extend it (or extend one of the classes in the AbstractRedirect hierachy)? Such classes have been designed with extendibility in mind. Vincenzo > -----Original Message----- > From: Lindsay Smith [mailto:[EMAIL PROTECTED] > Sent: gioved� 9 ottobre 2003 9.46 > To: James Users List > Subject: RE: How to clone a mail > > > Thanks, good tip. The reason to clone is to make a Mailet like > ForwardMailet, the same as the standard forward mailet but with a "forward > as a copy" option, ie the original recipient still receives the mail. The > complication is that the mail needs to go back to the root, as the new > "forwardee" address need to go through the alias resolving and group > resolving mailets. > > This leads to the recursive situation where the mail has an address which > will resolve as a forward and is being processed again. > > So the way I see to solve the problem is in this new > ForwardMailet to clone > the mail, send the "forwarded" mail with new addresses back to > the root (for > alias, group resolving mailets to process) , and send a "cloned > email", with > the recipients who want "forward as a copy" on to "processor" [as > sending it > back to the root woud invoke this Forward mailet again]. > > cheers > linds > > -----Original Message----- > From: Noel J. Bergman [mailto:[EMAIL PROTECTED] > Sent: 09 October 2003 08:23 > To: James Users List; [EMAIL PROTECTED] > Subject: RE: How to clone a mail > > > Lindsey, > > Why do you need to make a clone? Internally, MailImpl has a duplicate() > method. See some of the production mailets. > > --- Noel > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
