I've now modified my code.

WildcardAlias is now a Mailet.  It iterates through the recipient
MailAddresses, looking for ones from a host that is local.  If one is found,
the regex is applied, extracting the real user.  A new MailAddress is built
and added to a List while the original MailAddress is removed from the
Mail's recipients.  Finally, the Mail is sent, via the MailetContext, to the
new recipient list (those that were built from the regex matches) and the
original Mail is left to go one (minus the extracted recipients).

It works.  Is it sound?

Regards,
Brian.

-----Original Message-----
From: Serge Knystautas [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 17, 2003 9:23 AM
To: James Users List
Subject: Re: What to do with my new matcher?


Brian J. Sayatovic wrote:
> Well, I'd like to say I understood that, but I'm not sure I did.
> 
> So given an e-mail addressed to [EMAIL PROTECTED] and [EMAIL PROTECTED], I want 
> my Matcher-or-Mailet to make sure it gets (locally) delivered to 
> [EMAIL PROTECTED] and [EMAIL PROTECTED] instead.  I get the impression I should be 
> using the "All" matcher from another responder to this thread.
> 
> If that's the case, thenw hat should my Matcher do?
> 
> 1. Modify the recipients to replace [EMAIL PROTECTED] with [EMAIL PROTECTED] ? 
> 2. MailetContext.send() the Mail to [EMAIL PROTECTED] 3. Something else?
> 
> I hate to say it, but I think I need a flow chart and Venn diagrams to 
> understand this.

Brian,

I didn't think this was that hard, but can see how your example is 
confusing you.  The intention was to have Matcher be a read-only 
dissection of the recipient list, and Mailets perform any changes.

To do what you want with the intention, you could have this:

Step A
- Matcher A returns [EMAIL PROTECTED]
- Mailet A squashes the matching recipient addresses to [EMAIL PROTECTED] and 
[EMAIL PROTECTED]

Step B
- Matcher B returns [EMAIL PROTECTED] or [EMAIL PROTECTED]
- Mailet B does whatever processing you want.

OR

Step A
- Matcher A returns [EMAIL PROTECTED]
- Mailet A does whatever processing you want.

I included the first alternative since it seems you wanted to squash the 
address names first, although I'm not sure why.

-- 
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com p.
301.656.5501 e. [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