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, 
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:


 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?

  • 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 "myaddress@yahoo.com";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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