Mail Server#MTA (mail transfer agent)
mynetworks = 192.168.0.0/16, 127.0.0.0/8
myhostname = smtp.example.com mydomain = example.com mydestination = $myhostname, localhost.$mydomain, localhost relay_domains = $mydestination, test1.com, test2.com
user1: user1@example.com
reflect /etc/aliases
# newaliases
Forward all emails and do not leave the original email
test@example.com
Forward all emails and leave the original email
\user1 test@example.com
relay_domains = example.com, example.jp transport_maps = hash:/etc/postfix/transport
example.com smtp:[x.x.x.x] example.jp smtp:[x.x.x.x]
postmap hash:/etc/postfix/transport systemctl reload postfix
You can use sender_dependent_default_transport_maps or sender_dependent_relayhost_maps.
sender_dependent_default_transport_maps = hash:/etc/postfix/sender_dependent_transport
@example.com stmp:[x.x.x.x]:25 @sub.example.com stmp:[x.x.x.x]:25
Overridden in transport table
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_dependent_relayhost
@example.com [x.x.x.x]:25 @sub.example.com [x.x.x.x]:25