[exim] Counting how many addresses a redirect router generat…

Top Page
Delete this message
Reply to this message
Author: Chris Siebenmann
Date:  
To: exim-users
CC: cks
Subject: [exim] Counting how many addresses a redirect router generates?
We have a mail system facility where we allow users to place files in
a special 'lists' directory and these files are then interpreted as
mailing lists with the contents being the recipients. Mechanically this
is implemented as a redirect router[*] with 'user =' to the owner of the
file, 'file = /the/dir/$local_part' with things like Exim/Sieve filters
disallowed, and so on. Generally, these mailing lists are used for two
purposes: as actual mailing lists with multiple recipients, or to create
address aliases for people (either internal people or external addresses).
For our purposes here, address aliases have a single recipient in the
file while actual mailing lists have multiple addresses.

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.)

    - cks
[*: We actually have multiple routers to cope with various special
    cases, like people who leave their files group-writeable.]