User Tools

Site Tools


outgoing_mails_from_postfix_to_relayhost

Outgoing mails from postfix to relayhost

In order to let another mail server handle your outgoing mail traffic you need basically two things:

Relayhost should allow your server to relay mails to it (not in this description)
Postfix should forward all mails to relayhost.

Edit /etc/postfix/main.cf add following line

relayhost = <relay server>

Reload postfix configguration:

service postfix reload

If you don't use your server as mail receiver, make sure postfix is only listening on port 25 on 127.0.0.1. In this way, incoming mails will not be handled.

 netstat -anp | grep 25
 tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1745/master         

In RHEL6 listening to 127.0.0.1 is the default configuration.
If this is not the case insert following line in /etc/postfix/main.cf:

inet_interfaces = loopback-only

and reload postfix configuration

Verify the server is able to relay mails via relayhost:

mail -s "Hello world" <your mail address>
<Type a message and end with ctrl+d>
outgoing_mails_from_postfix_to_relayhost.txt · Last modified: 2011/06/24 13:15 by root