Re: [exim] using multiply routers

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Todd Lyons
Date:  
À: Cyborg
CC: exim-users
Sujet: Re: [exim] using multiply routers
On Mon, Oct 10, 2011 at 8:01 AM, Cyborg <cyborg2@???> wrote:
>
> to clear thinks up, the database has several lines for several types of
> mailadresses:
>
> autoresponder
> mailboxes of type pop3 and imap
> forwarder
> aso.
>
> if you do a
>
>  select target,type from mail_config where address="example@???"
>
> i may return several lines of hits.


Ok, you need to detect that count(target) is greater than 1 for an address.

> I thought, that one responder should only handle one type ( or two similar
> types like imap/pop3 ) at once.


And that's fine. The problem is that you want more than one router to
handle a specific message. The way to do that is to detect in your
conditions that you will need to handle more than one delivery for the
same recipient, handle one of those multiple conditions, and then let
the remaining condition be handled by your existing router. To
paraphrase:

forwarder:
conditon = is set to forwarder?
data = extract the email to forward to
unseen = true if address has more than one match in database

mailboxes:
condition = is set to imap/pop?
data = extract the maildir to deliver to

> ATM, the sort order of the routers in the config file decides which one of
> those i mentioned above work.
> The first one wins.


Correct. And then you use the "unseen" option to tell exim that it
should continue processing routers even though the current one
matched.
http://www.exim.org/exim-html-current/doc/html/spec_html/ch15.html
Scroll down to "unseen", it's near the end.

Totally untested, but you get the idea:
# Global definition:
DETECT_MULTIPLE=SELECT '1' FROM mail_config WHERE address =
'${quote_mysql:${local_part}@${domain}}'

and then in the first router where it might hit a duplicate:
unseen = ${if >{${lookup mysql{DETECT_MULTIPLE}}} {1} {yes}{no}}

Regards...       Todd
-- 
If Americans could eliminate sugary beverages, potatoes, white bread,
pasta, white rice and sugary snacks, we would wipe out almost all the
problems we have with weight and diabetes and other metabolic
diseases. -- Dr. Walter Willett, Harvard School of Public Health