We have 2 servers, server A and Server B in same domain. I have already configured the Serevr A to send an email to the internet (outside domain) by opening the port 25 to the internet.
Now I need to send an email to the outside domain from Server B using server A. I have opened the port between these two servers but not to the internet from server B.
Please help me to configure the server B mail settings to send the Email outside the domain through server A
Add a relayhost to your main.cf in /etc/postfix/ on the server you wish to act as the secondary mail server.
f.ex.
relayhost = [my.cool.smtp.server]:25
Where my.cool.smtp.server is naturally the IP address of your primary SMTP server you wish to relay through.
Your main postfix server must allow relaying through it from the ip/range that your other server is relaying from so make sure mynetworks is properly configured or it’ll refuse relaying.
You need to define, on the main server, in main.cf in the postfix configuration the parameter mynetworks_style and mynetworks that includes the secondary server.
If you have edited the main.cf by hand and not used the openSUSE YAST tool to do this, you will find it near the end of the file;
This is only suitable as a configuration if you have control of an entire subnet and you wish clients inside it to be able to relay through it - for example 192.168.1.0/24
Google for mynetworks_style and mynetworks postfix to see examples and how to control what hosts can relay through it. Make sure you do not accidentally make it a server everyone can relay through.