Hello Viktor,

Thanks for the quick reply. I tried the second variant because it seems less 
invasive for the existing
configuration than variant 1. I don't see all the consequences of deleting the 
domain from
virtual_alias_domains and adding it to virtual_mailbox_domains.

Unfortunately variant 2 did not work. The generic rewrite does not take place. 
So the verbatim.invalid
address is used for the final delivery.

Regards,
Ingo

Am 13.03.25 um 15:17 schrieb Viktor Dukhovni via Postfix-users:
On Thu, Mar 13, 2025 at 02:55:00PM +0100, rog7993--- via Postfix-users wrote:

In simple terms, the configuration looks like this:

/etc/postfix/main.cf:
   virtual_alias_domains = example.com
   virtual_alias_maps = hash:/etc/postfix/virtual
   transport_maps = hash:/etc/postfix/transport

The new requirement is to route some mail
addresses of the mail domain without address rewriting. I am aware that this 
could in principle be
realized via a rule in "transport_maps", e.g:

/etc/postfix/transport:
   us...@example.com       smtp:[some_other_destination]

But then the mail is rejected in the SMTP handshake as soon as it is sent:

   Recipient address rejected: User unknown in virtual alias table

As documented, all valid recipients in domains listed in
virtual_alias_domains MUST be rewritten to some real domain,
that's the definition of "virtual" in a "virtual alias domain".

How could this be solved in the existing configuration with virtual_alias_maps?

You have two choices (the first is probably simpler):

     1. Remove the domain from virtual_alias_domains, and instead
        list it in virtual_mailbox_domains:

         main.cf:
             virtual_mailbox_domains = example.com
             default_database_type = hash
             indexed = ${default_database_type}:${config_directory}/
             virtual_alias_maps = ${indexed}virtual
             virtual_transport = relay:[mailstore.example]
             transport_maps = ${indexed}transport

         virtual:
             ...
             # Delivered verbatim via $virtual_transport
             us...@examp.com     us...@example.com

     2.  Leave the domain alone, but rewrite the recipient address
         back to original form during delivery:

         main.cf:
             virtual_alias_domains = example.com
             default_database_type = hash
             indexed = ${default_database_type}:${config_directory}/
             smtp_generic_maps = ${indexed}generic
             virtual_alias_maps = ${indexed}virtual
             transport_maps = ${indexed}transport

         virtual:
             ...
             # Transient rewrite
             us...@example.com   us...@example.com.verbatim.invalid

         transport:
             example.com.verbatim.invalid    relay:[mailstore.example]

         generic:
             # Undo recipient rewrite
             us...@example.com.verbatim.invalid  us...@example.com


_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to