I'm using Postfix as a main MX server, connected to internet. On LAN I have MS Exchange, not accessible from internet.

Postfix works fine with virtual mailboxes, Dovecot for POP3/IMAP etc. I'm using catch-all virtual_alias_maps - have @mydomain.cz -> myreal@email.cz.

I want to forward mails for specific recipient addresses to Exchange server. Normally it's done with transport_maps, but when I use catch-all virtual alias, mail is sent to myreal@email.cz and not processed with transport_maps.

Is it possible to use transport_maps with catch-all virtual_alias_maps?

Interesting parts of Postfix configuration:

transport_maps = mysql:/etc/postfix/mysql-virtual-transports.cf
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_gid_maps = static:5000
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = dovecot
virtual_uid_maps = static:5000

MySQL .cf files:

query = SELECT password FROM virtual_users WHERE email='%u' LIMIT 1
query = SELECT destination FROM virtual_aliases WHERE source='%s'
query = SELECT 1 FROM virtual_domains WHERE name='%s'
query = SELECT 1 FROM virtual_users WHERE email='%s'

table = transport
select_field = transport
where_field = domain
additional_conditions = and active = '1'

Schema of the problem

  • 1
    myreal@email.cz is handled by exchange server? Add output of the 'postconf -n' to the question – ALex_hha Mar 2 '16 at 19:28
  • No, it's not. It's independent e-mail address. By Exchange server is handled for ex. user1@mydomain.cz. I simply don't want to rely on exchange server to handle all e-mails (whole domain), so I send them to Postfix first and only a few users use Exchange. – Xdg Mar 2 '16 at 20:29
  • I've added an image of the problem. – Xdg Mar 3 '16 at 6:21

Your Answer

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

Browse other questions tagged or ask your own question.