Your Linux Data Center Experts

Aliases for vPostMaster domains

vPostMaster does not internally support "aliases". By aliases, I'm talking about a simple mapping of one e-mail address to one or more others. vPostMaster does support having one account forward mail to others, optionally while storing a copy in the local account, but this does require that a real account be set up, complete with password, etc.

This is the preferred way of doing aliases in vPostMaster, because then all accounts are treated the same, and users don't get confused with two separate locations for where an e-mail address may be handled.

However, you can configure Postfix to do aliases if you absolutely must have them.

In the "main.cf" file, you will need to add the line:

   virtual_alias_maps = regexp:/etc/postfix/virtual-regexp $alias_maps

And then in the section under "smtpd_recipient_restrictions" you need to add the following line before the "check_policy_service unix:private/vpm-pfpolicy" line:

   check_recipient_maps regexp:/etc/postfix/virtual-regexp-allow

This example uses regexp maps, but this could just as easily be a hash.

You will need to create these two files mentioned above. In the "virtual-regexp" file, you need to list the aliase account and the address it's translated to. For example, if you want to forward "foo" to "bar" and "baz" in the "example.com" domain:

   /^foo@example.com$/   bar@example.com, baz@example.com

In the "virtual-regexp-allow" file, you need to list the same left-hand with "OK" for the right hand, so that the SMTP server knows to allow this address:

   /^foo@example.com$/   OK

If your mailserver should also handle messages for other hosts or subdomains, you may need to adjust these rules. For example the pattern:

   /^foo@(.*\.)?example.com$/

would handle mail for foo@pines.example.com, foo@fjord.example.com and foo@example.com, but would reject messages for foo@bad-example.com.

Restart Postfix and now when you mail "foo@example.com" it should deliver to "bar@example.com" and "baz@example.com".