Postfix tries to lookup external address locally

Postfix might select virtual for domains it is not actually supposed to handle when one of your lookups returns a (any) result when it should not: a false positive.

It is likely transport_maps or virtual_mailbox_domains (defaults to deferring to virtual_mailbox_maps). You have proven this theory if both your domain and one that should in fact be relayed produce results from one of your configured lookups, e.g. try this:

postmap -q [email protected] sqlite:/etc/postfix/sqlite_virtual_mailbox_maps.cf
postmap -q [email protected] sqlite:/etc/postfix/sqlite_virtual_mailbox_maps.cf
postmap -q @other.example sqlite:/etc/postfix/sqlite_virtual_mailbox_maps.cf

postmap -q mydomain.example sqlite:/etc/postfix/sqlite_transports_maps.cf
postmap -q other.example sqlite:/etc/postfix/sqlite_transports_maps.cf

If you got results for both, take a stern look at the query, specifically the WHERE clause with the placeholder (starting with %) and determine why it returns more results for domains you have not explicitly put into your database. Returning the key itself or static results is common in Postfix so it does not trigger a warning.. it is just not useful to your case.


I have not used Amavis this way, but I believe that overriding transports in Postfix is not needed for standard use cases such as this. Instead, use the fact that Postfix will check the respective transport_mailbox_domains lookups to determine which domains and mailboxes are transported how.

You may not need overriding transport for this, and will likely get a more flexible and less error-prone setup if you list your virtual domains in virtual_mailbox_domains instead of transport_maps and use the latter only for specific overrides.