Send Mail From Linux To A Mail Relay Service

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.

  1. Install postfix package.
  2. yum install postfix

  3. Edit /etc/postfix/main.cf
  4. 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.

    Postfix Main Configuration

  5. Changing configuration on mail relay service
  6. 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.

Be First to Comment

    Leave a Reply