Lindsay,

You should have getRecipients(Mail) return a collection with the new extra recipient, 
and getPassThrough() return true so that the original message is delivered to the 
original recipients.

This should be totally enough, unless you want both the original and the new 
recipients know about each other: in this case build a new consolidated collection in 
getRecipients(Mail) and return an equivalent InternetAddress[] in getTo(Mail) too, 
with getPassThrough() returning false. 

Vincenzo

> -----Original Message-----
> From: Lindsay Smith [mailto:[EMAIL PROTECTED]
> Sent: luned� 21 luglio 2003 19.53
> To: James Users List
> Subject: RE: AbstractRedirect.java how to use?
> 
> 
> Hi Vincenzo,
> 
> I think what I want is I need a custom Mailet because I have to query a DB
> to get who the forward addresses are.
> From what you explain I think I want ...
> 
> AbstractRedirect.getRecipients(Mail)
> 
> What additional stuff do I need to do to forward the mail to new extra
> recipients?
> 
> Just:
> mail.setRecipients(Collection);
> 
> Do I need to do anything after this?
> 
> It seems this setRecipients() signature in the Mail interface 
> must have been
> added after 2.2.0a7 because I get unresolved symbol compiling but it's in
> the online javadoc.
> 
> Any advice appreciated.
> 
> Regards
> Lindsay Smith
> 
> -----Original Message-----
> From: Vincenzo Gianferrari Pini
> [mailto:[EMAIL PROTECTED]
> Sent: 21 July 2003 18:04
> To: James Users List
> Subject: RE: AbstractRedirect.java how to use?
> 
> 
> 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]
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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