Table of Contents

Guide to Setting up a Central MTA Relay Server (work in progress)

If you have many, many application servers, then sometimes you may wish to have all outbound email handled by one or more outbound relay mail hosts. This can be somewhat easier to manage over time.

Joyent Accelerators make good SMTP relay hosts with the proper setup and come pre-installed with Postfix.

On the MTA server

Open port 25 on the server

Create A record for the server 

mta.domainname.com -> ipaddress

You will have to log a ticket to joyent to do this as the owner of the IP address itself must create the PTR record.

Create PTR record for the server 

ipaddress -> mta.domainname.com

Create MX record for the server 

mta.domainname.com mail exchanger = 10 mta.domainname.com

Create SPF record

v=spf1 include:domainname.com a:mta.domainname.com ~all

Edit Main.cf

Changes to /etc/postfix/main.cf

myhostname = mta.domainname.com
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks = 127.0.0.1/32, 127.0.0.0/8, (IP addresses of host that will send relay mail to this server)
smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination
smtp_connection_cache_on_demand = yes
smtp_connection_cache_destinations = yahoo.com,yahoo.com.cn, yahoo.com.br, yahoo.co.in, yahoo.es, yahoo.com.ar, yahoo.co.kr, yahoo.co.id
smtp_connection_cache_time_limit = 10
smtp_connection_cache_reuse_limit = 50
minimal_backoff_time =  150
maximal_backoff_time = 150
queue_run_delay= 150

Hosts Setup Review

Make sure your server host name and domain are set to same as in the DNS /etc/hosts:

ipaddress           mta.domainname.com  mta
/etc/sysconfig/network:

HOSTNAME=mta.domainname.com
DOMAINNAME=domainname.com

Restart

Restart the MTA server

On Each Application Server

Change Main.cf

Changes to /etc/postfix/main.cf

relayhost = ipaddress (the ip of the MTA goes here)

Restart Postfix

Reload postfix

Core Documentation contributed by Pavel Pragin of SolutionSet.