Setting your Postfix self-hosted mail server up for multiple domains
Use a single server to host email for multiple domains wqithout having to create a UNIX system account for every email.
- With virtual alias domains, each hosted address is aliased to a local UNIX system account or to a remote address.
- NEVER list a virtual alias domain name as a mydestination domain!
- Execute the command
postmap /etc/postfix/virtualafter changing the virtual file, and execute the command
postfix reloadafter changing the
- Note: virtual aliases can resolve to a local address or to a remote address, or both. They don't have to resolve to UNIX system accounts on your machine.
# /etc/postfix/main.cf virtual_alias_domains = example.com ...other hosted domains... virtual_alias_maps = hash:/etc/postfix/virtual
# /etc/postfix/virtual email@example.com postmaster firstname.lastname@example.org joe email@example.com jane # Uncomment entry below to implement a catch-all address # @example.com jim ...virtual aliases for more domains...
Mail accounts without system user accounts
Maildir style delivery where a mailbox pathname is used instead of a UNIX system account is used can be used to create virtual mailboxes. That way you don't have to create a system account for every user that you want to give email accesss to.
Maildir style delivery is turned on by terminating the mailbox pathname with
# Virtual Mailbox related config # /etc/postfix/main.cf virtual_mailbox_domains = example.com ...more domains... virtual_mailbox_base = /var/mail/vhosts virtual_mailbox_maps = hash:/etc/postfix/vmailbox virtual_minimum_uid = 100 virtual_uid_maps = static:5000 virtual_gid_maps = static:5000 virtual_alias_maps = hash:/etc/postfix/virtual
# /etc/postfix/vmailbox: firstname.lastname@example.org example.com/info email@example.com example.com/sales/ # Comment out the entry below to implement a catch-all. # @example.com example.com/catchall ...virtual mailboxes for more domains...
# /etc/postfix/virtual: firstname.lastname@example.org postmaster