I have 2 servers with postfix.
ServerA with this main.cf:
relayhost = smtp.public.com:587
smtp_use_tls=yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/smarthost_passwd
smtp_sasl_security_options =
Sending emails locally from server A works fine, it does properly the relay over the public smtp and the message arrives to the destination
Now I want to configure ServerB so that when I send an email from it, it will go directly to ServerA which should send the email through the public smtp server (as it does when sending from ServerA by itself)
Telnet from ServerB to ServerA on port 25 is working.
How can I perform this configuration ? I'm not even able to find the correct words for googling it.
EDIT
It worked after following the validated answer.
In case of this can be useful for someone else, these are the configuration files that I finally used:
ServerA:
main.cf:
relayhost = <IP/domain SMTP externe>:<port>
smtp_use_tls=yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/smarthost_passwd
smtp_sasl_security_options =
mynetworks = <Net of ServerB>
/etc/postfix/smarthost_passwd:
<IP/domain SMTP externe>:<port> <user>:<pass>
ServerB:
main.cf:
relayhost = <hostname_ServerA>:<port>
smtp_use_tls=yes
smtp_sasl_auth_enable = no
smtp_sasl_security_options =