I'm trying to work out how I can get postfix to accept email for any sub-domain of my main site. I don't have virtual domains, just a long list of sub-domains for local delivery. In specific, I'm feeding python@*.mydomain.com
into a Python using the alias file:
python: |/www/proc_email.py
The Python can handle delivery from there. I envision this looking something along the lines of:
mydestination = encendio, localhost.localdomain, localhost, *.mydomain.com
I'm running the latest version of postfix on Ubuntu (not rightly sure how to check the version).
Thanks in advance.
You can't use wildcards if you explicitly list the destinations in your Postfix config, but fortunately the
$mydestination
option accepts table lookups. So try setting$mydestination
to a pcre map like this:Then create
/etc/postfix/mydestinations
with properly anchored and escaped regexps:Technically you could put anything at all in the place of "ACCEPT" as the result is ignored; just the presence of the match is sufficient:
The pcre solution in the accepted answer works well, but you might want to consider anchoring the regexp to avoid getting hits on just part of the domain name.
*.mydomain.com
wont work.You need to create
relay-domains
and put all your subdomains in there. 1 per line.