0

I've a Postfix setup with virtual users running just fine. Some of my users redirect their email to external email gmail accounts, for example: [email protected] is forwarded to [email protected] for their own convenience via virtual_alias_maps.

Now I tried to use transport_maps to have a dedicated transport for those forwardings like so:

main.cf:

virtual_transport = lmtp:unix:private/dovecot-lmtp virtual_alias_maps = mysql:/etc/postfix/virtual/mysql-alias-maps.cf virtual_mailbox_domains = mysql:/etc/postfix/virtual/mysql-mailbox-domains.cf virtual_mailbox_maps = mysql:/etc/postfix/virtual/mysql-mailbox-maps.cf default_transport = out-default transport_maps = mysql:/etc/postfix/virtual/mysql-transport-maps.cf 

master.cf:

out-default unix - - n - - smtp -o proxy_interfaces=$smtp_default_transport_proxy_interface -o smtp_bind_address=$smtp_default_transport_interfaces -o inet_interfaces=$smtp_default_transport_interfaces -o myhostname=$smtp_default_transport_hostname -o smtp_helo_name=$smtp_default_transport_hostname -o syslog_name=smtp-$smtp_default_transport_hostname out-fwd unix - - n - - smtp -o proxy_interfaces=$smtp_default_transport_proxy_interface -o smtp_bind_address=$smtp_default_transport_interfaces -o inet_interfaces=$smtp_default_transport_interfaces -o myhostname=$smtp_default_transport_hostname -o smtp_helo_name=$smtp_default_transport_hostname -o syslog_name=smtp-fwd-$smtp_default_transport_hostname -o bounce_queue_lifetime=0 -o maximal_queue_lifetime=0 

mysql-alias-maps.cf:

query = SELECT destination FROM `aliases` WHERE source='%s' 

mysql-transport-maps.cf:

query = SELECT IF (ISNULL(destination), NULL, 'out-fwd') as transport \ FROM `aliases` \ WHERE destination='%s' \ AND destination LIKE '%%@gmail.com' 

What I'm trying to accomplish is "if the user has their email forwarded to a @gmail reduce the queue lifetime."

Now when I try to send and email to those users this is what happens:

postfix/qmgr[28839]: warning: connect to transport private/out-fwd,out-fwd: No such file or directory 

private/out-fwd,out-fwd > Why is it duplicating the name of the transport?

If I change the query to return out-fwd: (colon at the end) I get:

smtp-fwd-xxxx/smtp[23429]: fatal: valid hostname or network address required in server description: ,out-fwd: 

,out-fwd: ??? Why?

Note that if I simply comment the transport_maps line email gets delivered using default_transport = out-default just fine.

Thank you.

1 Answer 1

0

I found the issue, it was my query. The query above would return multiple results if there was more than one local account forwarded / aliased to the same external gmail account and due to some reason Postfix would concatenate the results.

query = SELECT IF (ISNULL(destination), NULL, 'out-fwd') as transport \ FROM `aliases` \ WHERE destination='%s' \ AND destination LIKE '%%@gmail.com' \ LIMIT 1 

Adding the LIMIT fixed the problem.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.