Yes, you can override AbstractRedirect.setRecipients(Mail, Collection, Mail), although 
it would be better to override AbstractRedirect.getRecipients() or 
AbstractRedirect.getRecipients(Mail) (none of them are final on purpose).

The choice is based on the following logic:

1) Use AbstractRedirect.getRecipients() if the recipients are a fixed address list, 
and/or one or more of the "magic" addresses (the postmaster address or 
SpecialAddress.SENDER or SpecialAddress.REVERSE_PATH or SpecialAddress.RECIPIENTS.

2) Use AbstractRedirect.getRecipients(Mail) if the recipients are to be determined 
"dynamically" using information from the original mail.

3) Use AbstractRedirect.setRecipients(Mail, Collection, Mail) if you need to do 
something more than sending to the recipients list.

You may even not need to write any new mailet, and just use either Resend, Redirect or 
Forward with the appropriate parameters.

If you tell me whom do you want to "forward as a copy" to (which logic you want to 
implement), I can give you an advice.

Vincenzo

> -----Original Message-----
> From: bt [mailto:[EMAIL PROTECTED]
> Sent: luned� 21 luglio 2003 18.31
> To: James Users List
> Subject: AbstractRedirect.java how to use?
> 
> 
> I'm trying to use AbstractRedirect.java to make some custom redirect
> behaviour. (different to the default redirection)
> 
> I need to use the originalMail.getUserName() to decide who to forward to.
> 
> Is it the right approach to over-ride this method in AbstractRedirect?
> 
>       protected void setRecipients(
>               Mail newMail,
>               Collection recipients,
>               Mail originalMail)
> 
> I looked at the built in Forward mailet, only the no argument setX methods
> get over-ridden.  Is it valid to over-ride the setX(mail, 
> collection, mail)
> signatures?
> 
> Then do
> ((MailImpl) newMail).setRecipients(forwardedAddresses);
> With the new addresses to forward to?
> 
> Is there more I need to do to get forwarding working?
> 
> I seem to just get in a loop. ie I forward a "A" which then comes back
> through the mailet who forwards to "A" (repeat).
> 
> What I am trying to achieve is to "forward as a copy", ie send to the
> original recipient, and forward also to another address.
> 
> Has anyone any tips?  Is using AbstractRedirect the right thing to do?
> 
> Regards
> Lindsay Smith
> 
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to