Danil Smirnov via Postfix-users:
> Hi,
> 
> I have a Postfix server that serves domain1.tld
> using transport_maps, local_recipient_maps, and relay_domains parameters in
> order to relay all incoming emails to the local LMPT listener.
> 
> Now I want to receive emails @domain2.tld in the same Postfix server and
> rewrite them all to domain1.tld BEFORE sending them to that LMPT listener.
> I'd like to do this for all emails @domain2.tld without listing them
> explicitly.
> 
> I've tried some approaches with no luck, this seems rather tricky. Is it
> possible to achieve this at all without using the second Postfix server?

This is one of the purposes of virtual_alias_maps.

It has to be used with care: if you simply rewrite @old.example to
@new.example, then the Postfix SMTP server will accept mail for
recipients that don't exist.

Option 1: enumerate each valid recipient

/etc/postfix/main.cf:
     virtual_alias_maps = hash:/etc/postfix/virtual_alias

/etc/postfix/virtual_alias
     user11@domain1.example user12@domain2.example
     user21@domain1.example user22@domain2.example
     ...

Option 2: wild-card mapping with recipient verification

/etc/postfix/main.cf:
     virtual_alias_maps = hash:/etc/postfix/virtual_alias 
     smtpd_recipient_restrictions =
        ...
        reject_unauth_destination
        reject_unverified_recipient
        ...
 
/etc/postfix/virtual_alias
    @domain1.example @domain2.example

References:
https://www.postfix.org/postconf.5.html#virtual_alias_maps
https://www.postfix.org/virtual.5.html

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

Reply via email to