I have my /etc/postfix/virtual file:
sub.domain.com DOMAIN
@sub.domain.com user2
domain.com DOMAIN
@domain.com user1
The mail for @sub.domain.com still goes to user1 and that's not what I want. Here's my /etc/postfix/my.cnf just in cases:
mydomain = domain.com
myhostname = mail.domain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
virtual_alias_maps = hash:/etc/postfix/virtual
myorigin = $mydomain
mydestination = $myhostname, $mydomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 1073741824
recipient_delimiter = +
inet_interfaces = all
parent_domain_matches_subdomains =
Note, that I set parent_domain_matches_subdomains to empty. But it still doesn't help. Any ideas?
The right hand side of your virtual_alias_maps table is an unqualified username.
Postfix appends $myorigin to unqualified usernames, making it effectively
@sub.example.com [email protected] @example.com [email protected]
Now [email protected] is caught by the catchall for @example.com.
Hence, mail for [email protected] goes to user1.
You could change your Postfix config to this:
mydomain = example.com myhostname = mail.example.com alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases virtual_alias_maps = hash:/etc/postfix/virtual myorigin = $mydomain mydestination = $myhostname, $mydomain, localhost relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 1073741824 recipient_delimiter = + inet_interfaces = all parent_domain_matches_subdomains = virtual_alias_domains = sub.example.com luser_relay = [email protected]
/etc/postfix/virtual
@sub.example.com [email protected]
Create two system accounts user1 and user2.