I'm using Postfix + Dovecot with a MySQL database as backend and PostfixAdmin to administrate users and domains. Now I'm looking for an easy and automated approach to define per-domain alias of the pattern all@domain.tld
with will resolve to all users of the given domain. I want to set this up once, and it shall keep working as expected even if accounts are added or deleted – so creating a file with a list of accounts manually, or using some mailing list are no options.
It should be pretty easy to retrieve all existing users for a given domain from the database:
SELECT username
FROM vmail
WHERE domain='%d';
(with %d
being the placeholder for the domain). But how can I tell postfix to do so for mails directed to all@domain.tld
, and of course only when such a mail comes from a trusted source (permit_sasl_authenticated
, permit_mynetworks
?)?
I've googled for a few hours now, but all I found were either "catch-alls" (just the opposite from what I want), solutions based on shell-scripts (walking the resp. domain directory), or using mailing-list approaches – none of that fitting my needs.