Email catch all (domain and subdomains) Postfix
I just want to catch all email sent to * @domain.com AND * @ * .domain.com to a unique email [email protected]
@runlevel6 Any idea to implement regexp in virtual like
cat /etc/postfix/virtual
@example.com [email protected]
/[@*].example.com$/ [email protected]
I found it:
in main.cf
virtual_alias_maps = regexp:/var/spool/postfix/plesk/virtual-sub
in virtual-sub
/[@.]example\.tld$/ [email protected]
thx runlevel6
Postfix supports the use of a catchall account using the luser_relay configuration option.
See the postfix page for luser_relay for more information.
When the local(8) delivery agent finds that a message recipient does not exist, the message is normally returned to the sender ("user unknown"). Sometimes it is desirable to forward mail for non-existing recipients to another machine. For this purpose you can specify an alternative destination with the luser_relay configuration parameter.
If it is not a catchall for all domains on the server you can instead user Virtual Aliases. See the postfix page for virtual aliases for more information. Short description and code excerpt from that page are as follows:
With virtual alias domains, each hosted address is aliased to a local UNIX system account or to a remote address. The example below shows how to use this mechanism for the example.com domain.
/etc/postfix/main.cf:
virtual_alias_domains = example.com ...other hosted domains...
virtual_alias_maps = hash:/etc/postfix/virtual
/etc/postfix/virtual:
[email protected] postmaster
[email protected] joe
[email protected] jane
# Uncomment entry below to implement a catch-all address
@example.com jim
...virtual aliases for more domains...
After making those changes, run postmap /etc/postfix/virtual
and postfix reload
.
EDIT: I think the regexp that you are looking for is /[@.]example\.com$/ system
You might need to make additional changes in main.cf to support this. See this post for more information.