1

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?

1
  • 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, 2013 at 12:28

1 Answer 1

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 "[email protected]";
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .