Saturday, March 21, 2015

Configuring Postfix as a Local Network Relay

This howto assumes that the relay server’s IP address is and is running RHEL/CentOS 7. Only mail from the network should be accepted and relayed.

Install Postfix

[root@rhce-server ~]# yum install postfix

Configure Systemd

[root@rhce-server ~]# systemctl enable postfix
[root@rhce-server ~]# ^enable^start

Configure the Firewall

[root@rhce-server ~]# firewall-cmd --add-service=smtp
[root@rhce-server ~]# firewall-cmd --add-service=smtp --permanent 

Configure Postfix

Postfix’s main configuration file is located at /etc/postfix/
Configure Postfix to listen on the correct interface.
inet_interfaces = all
Configure the trusted network.
mynetworks =
Configure the list of domains that this Postfix service should consider itself the final destination for. In my case the server is named rhce-server.
mydestination = rhce-server, localhost.localdomain, localhost
Configure all mail not destined for this server to be relayed to another SMTP server. I am using Time Warner Cable’s SMTP server for Northeast Ohio. The brackets tell Postfix to turn off MX lookups.
relayhost = []

Restart Postfix

[root@rhce-server postfix]# systemctl restart postfix

Send a Test Email

[root@rhce-server postfix]# mail -s "rhce-server test"
testing our null postfix configuration
With any luck we should be all set. You can verify the mail was successfully relayed in /var/log/maillog.

1 comment:

  1. You have shared a nice article here about the SMTP server. Your article is very informative and I liked your way to share this article here. If anyone looking for the Reliable SMTP Server services, Visit Mails2inbox