I suspect I know the answer - but it doesn't hurt to ask.
I have a Postfix config set up which uses 4 mysql maps to create role
based emails for a (large) set of clubs.
The rules in the SQL aren't stunningly complex but they are non-trivial.
I'd prefer not to implement them in several places, because I know they
will get out of sync if that is done.
They handle cases like there is a temporary redirect in place for the
role, the club post isn't filled so send to the secretary, the new
committee takes over so all the roles shuffled around because of year
change. Several posts have multiple aliases. Some clubs haven't signed
up to the system. You can imagine the sort of thing that apply if you've
ever been in a club with a formal constitution.
Two of the maps check addresses for validity of an address (e.g.
role@domain are valid role and valid domain). There are two types of
club, one map each.
Two of the maps transfer us from virtual address to final delivery
address (secretary@domain -> sim...@zynet.net). Again the same division,
two types of club, one map each.
The main reason to keep these separate for types of club is simplicity
of thinking, Postfix doesn't care, and indeed does slightly more work
because there are 4 maps instead of 2.
I now want to produce some reporting based on these mappings.
The output I want initially is what "sendmail -bv" was invented for, the
mapping from role email to actual email.
I'm assuming from the "sendmail -bv" discussion in archives that Postfix
doesn't allow me to make this query, in general, without simply feeding
an email through the system? e.g.. "sendmail -bv" works in exactly that
way, presumably for similar reasons? Or is there an exposed API
somewhere that answers the same question?
Otherwise I suspect either I should push the query logic into stored
procedures in the database (rather than Postfix files), and call them
directly when generating the report. Or possibly a setuid script to call
"postmap -q" (yuck).
Simon