Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

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

1 Answer 1

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";
}
share|improve this answer

Your Answer

 
discard

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.