I've 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 would go to user1 and that is not things i want. Here's my /etc/postfix/my.cnf just in the event:

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, which i set parent_domain_matches_subdomains to empty. However it still does not help. Any ideas?

The best hands side of the virtual_alias_maps table is definitely an unqualified username.

Postfix appends $myorigin to unqualified usernames, which makes it effectively

@sub.example.com user2@example.com @example.com user1@example.com

Now user2@example.com is caught through the catchall for @example.com.

Hence, mail for user2@example.com would go to user1.

You can improve your Postfix config for 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.../8 [::ffff:127...]/104 [::1]/128

mailbox_size_limit = 1073741824

recipient_delimiter = +

inet_connects = all

parent_domain_matches_subdomains =

virtual_alias_domain names = sub.example.com

luser_relay = user2@example.com

/etc/postfix/virtual
@sub.example.com user1@example.com

Create two system accounts user1 and user2.