Postfix has two important domains:

The relevant configuration in looks like this:

 virtual_mailbox_domains = /etc/postfix/virtual_mailbox_domains
virtual_alias_domains = /etc/postfix/virtual_alias_domains

What's the content in them? We can give an example as follows.

 # cat virtual_mailbox_domains
 # cat virtual_alias_domains

Here and have the real mailbox. While and are alias domains who have none mailbox.

After creating the two files, don't forget to reload postfix.

 # service postfix reload

And then, we need to create the real users who have the mailboxes. The real users are located in dovecot's userdb.

 # cat /etc/dovecot/dovecot-users 
[email protected]:{plain}strong_pass_here
[email protected]:{plain}strong_pass_here

How to create the real users for dovecot? please check my before note below.

Install postfix dovecot squirrelmail letsencrypt on ubuntu

For now, wen can setup the alias users for alias domains. The messages sent to alias users will be forwarded to the real users.

Add this line into

 virtual_alias_maps = hash:/etc/postfix/virtual_alias_maps

The content in this file looks like this:

 # cat virtual_alias_maps [email protected] [email protected]

Here I just specified two catchall forwardings:

Surely you can also specify the specific users here, such as [email protected].

Run postmap to create the database for hash map, and reload postfix.

 # postmap virtual_alias_maps
# service postfix reload

All done. You can test it by sending a message to [email protected] which will be forwarded to [email protected]. And messages sent to [email protected] will be forwarded to [email protected].

Return to home | Generated on 11/06/22