I have configured a Postfix mail server for two domains: domain1.com and domain2.com.
In my configuration domain1 has both virtual
users with Maildirs and aliases to forward mail to local
users (eg. root, webmaster) and some small mailing lists. It also has some virtual mappings to non-local domains.
Domain2 on the other hand has only virtual alias mappings, mainly to corresponding '
users' at domain1 (eg. mails to
[email protected] should be forwarded to
[email protected]).
My problem is that currently Postfix accepts mail even for those
users that don't exist in the system. Mail to existing
users and /etc/aliases works fine. Postfix documentation states that the same domain should never be specified in both mydestination and virtual_mailbox_maps, but If I specify mydestination as blank then postfix validates recipients against virtual_mailbox_maps but rejects mail for local aliases of domain1.com.
/etc/postfix/main.cf:
myhostname = domain1.com
mydomain = domain1.com
mydestinations = $myhostname, localhost.$mydomain, localhost
virtual_mailbox_domains = domain1.com
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_mailbox_base = /home/vmail/domains
virtual_alias_domains = domain2.com
virtual_alias_maps = hash:/etc/postfix/virtual
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
virtual_transport = dovecot
/etc/postfix/virtual:
domain1.com right-hand-content-does-not-matter
firstname.lastname user1
[more aliases..]
domain2.com right-hand-content-does-not-matter
@domain2.com @domain1.com
/etc/postfix/vmailbox:
[email protected] user1/Maildir
[email protected] user2/Maildir
/etc/aliases:
root: :include:/etc/postfix/aliases/root
webmaster: :include:/etc/postfix/aliases/webmaster
[etc..]
Is this approach correct or is there some other way to configure Postfix with Dovecot (virtual) Maildirs and Postfix aliases?