In most medium to large businesses there are times, when you need to send mail to a mail relay service. This is used due to restrictions in access to external networks. Instead of having to open ports for every server in a network to allow sending of mail. You setup a mail relay server to allow mail to be routed through.
Here is how you setup a server to send mail to mail relay service instead of through the default gateway.
- Install postfix package.
- Edit /etc/postfix/main.cf
- Changing configuration on mail relay service
yum install postfix
See below for what the lines look like that you would need to find. You will need to uncomment the line you need by removing the hash. Normally you would just use the ip address so would need to edit the last relayhost line.
Set your mail relay service to accept email from the host. Unless your mail relay service is open, most relay services you need to specify to allow mail from the host. Normally this is a list of ip addresses for allowed senders.