2014/01/24

Postfix mail relaying

RHEL 6 (and CentOS) have moved from sendmail to postfix. This is for the most part a Good Thing; sendmail was a mess. However it means I have to learn some new stuff. Specifically, how to convince postfix to relay email through my ISP's SMTP server.

First, I have a VM that does relaying for all my other computers. On this VM, I set up postfix to relay all mail :

# /etc/postfix/main.cf
myorigin = awale.qc.ca
relayhost = smtp.cgocable.ca
inet_interfaces = all
mynetworks = 10.0.0.0/24, 127.0.0.0/8

myorigin means user@localhost becomes user@awale.qc.ca.

relayhost is where email is relayed to.

inet_interfaces means postfix will listen for SMTP on all the VMs networks (default is only localhost).

mynetworks means postfix will trust any email coming from a host on my LAN. Yes, this is not very secure. But I trust my LAN explicitly. I have Wifi on a separate subnet, so anything on my LAN will have to be physically connected to my LAN.

On other computers/VMs, I just need myorigin and relayhost. This last points to the postfix VM, not COGECO.

No comments: