In Exim I have one file per domain where the filename itself is used to determine the domain for the aliases.
For example, I'd have a file named example.org with contents like this:
foo: somelocaluser
This causes mail to [email protected]
to be delivered to somelocaluser
.
In Postfix the common setup is to use the file named virtual
and repeat the domain for every local part over and over again:
[email protected]: somelocaluser
[email protected]: somelocaluser
How can I achieve my Exim-style setup in Postfix and thus avoid the repetiton?
No, you can't
Your desired feature doesn't exist in postfix hash table. Postfix database lookup always get key from the entry of the file, it can't mix it with the file name.
More info: Postfix Lookup Table Overview
However, you can achieve the same with little scripting. The script should loop all files then append the file name string to first column of the entry then combine it.
The ugly script like this should do the job fine
Don't forget to
postmap
orpostalias
the output file.