Re: [exim] Counting how many addresses a redirect router gen…

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Phil Pennock
Fecha:  
A: Chris Siebenmann
Cc: exim-users
Asunto: Re: [exim] Counting how many addresses a redirect router generates?
On 2016-11-02 at 12:42 -0400, Chris Siebenmann wrote:
> We have recently wound up wanting to be able to tell the difference
> between the two sorts of 'mailing lists', so we can treat email passing
> through them somewhat differently. So, is there any good way to do
> something like count the number of addresses generated from a redirect
> expansion? Alternately, can people think of clever other ways to do this?
>
> (I would rather not descend to the brute force level of running a
> command to count the number of non-blank, non-comment lines in the file,
> especially as we would have to arrange to run this command as the user
> who owns the file.)


Write a command to analyze it, and create one of two alternative output
files which flag the result and which always outputs `DECLINE` to
stdout. Handle that the command _might_ be invoked concurrently on
different hosts mounting the NFS area.

Write a queryprogram Router rule which runs when the redirect Router
would; skip invoking the Router if either of the two resulting
predictable-path files above already exists; rely upon the Router
outputting DECLINE so that the usual Router actually does the delivery.
The `command_user` Router option should be set appropriately, so that
Exim does the per-user stuff for you.

Every email address handled should invoke the queryprogram external
command "probably once", depending upon races between mails arriving and
output files existing.

You can then have other new Routers act based upon existence of those
files.

Bonus points if your queryprogram Router condition _will_ re-invoke the
command if the list file is newer than the output flag file which would
otherwise inhibit it, and the program does handle deleting the "wrong"
flag-file if it exists at the point when it would otherwise write the
"right" one.

Figure out what sort of admin action you want to take 28 days later on
any addresses which haven't received a mail which created the flag-file.
:)

-Phil