MBF Knowledge Base

I need to forward emails using the .forward file and it is possible only for shell accounts and not virtual mailboxes to do this. I need to have both types of mailboxes, one to store and one to forward. Is it possible to have shell account mailboxes along with virtual mailboxes in Postfix?

Yes, this is possible.

For example, let's assume this:

first@mydomain.com => goes to /home/first/..
second@mydomain.com => goes to /var/spool/mail/virtual/..

Edit your /etc/postfix/main.cf as follows:

mydestination = localhost
virtual_mailbox_domains = mydomain.com
virtual_alias_maps = hash:/etc/postfix/virtual_alias
virtual_mailbox_base = /var/spool/mail/virtual
virtual_mailbox_maps = hash:/etc/postfix/virtual_mailbox
virtual_minimum_uid = 100
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000

Edit /etc/postfix/virtual_alias:

first@mydomain.com first

Edit /etc/postfix/virtual_mailbox:

virtual@mydomain.com mydomain.com/virtual/

Lastly, run the following commands:

postmap /etc/postfix/virtual_alias
postmap /etc/postfix/virtual_mailbox
postfix reload