Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 address and wants me to do the same.

Currently I'm setting things up like this in (only relevant bits shown):

virtual_alias_domains = 
# This line cut in two here for clarity
virtual_alias_maps = proxy:mysql:/etc/postfix/, 
virtual_mailbox_domains = proxy:mysql:/etc/postfix/
virtual_mailbox_maps = proxy:mysql:/etc/postfix/

And the relevant parts in the configfiles are:

 query = SELECT destination FROM forwardings WHERE source='%s'

query = SELECT email FROM users WHERE email='%s'

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?

share|improve this question
If it were me, I'd do the split on procmail - but it deson't talk to mysql out of the box. – symcbean Apr 25 '13 at 12:28

In the end, I took the easy way out, and used a Sieve script on the server to do the forwarding:

require ["fileinto"];

if anyof (true)
    fileinto "INBOX";
    redirect "";
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.