One of my users who has mail hosted on Google Apps, but uses my domain, wants to move email hosting directly on my server. However, this user has a rule that stores and forwards every received mail to a @yahoo.com address and wants me to do the same.
Currently I'm setting things up like this in main.cf
(only relevant bits shown):
virtual_alias_domains =
# This line cut in two here for clarity
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf,
mysql:/etc/postfix/mysql-virtual_email2email.cf
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
And the relevant parts in the configfiles are:
mysql-virtual_forwardings.cf
:
query = SELECT destination FROM forwardings WHERE source='%s'
mysql-virtual_email2email.cf
:
query = SELECT email FROM users WHERE email='%s'
mysql-virtual-mailboxes.cf
:
query = SELECT CONCAT(SUBSTRING_INDEX(email,'@',-1),'/',SUBSTRING_INDEX(email,'@',1),'/') FROM users WHERE email='%s'
The forwardings table has just 2 columns, source and destination. The users table is a two column user@domain-password table.
What can I do to have postfix deliver to the account here, but also forward to the yahoo account?
Best Answer
In the end, I took the easy way out, and used a Sieve script on the server to do the forwarding: