wiki:relay-server-by-domain

Version 2 (modified by Jamie McClelland, 6 years ago) (diff)

--

Relay Server By Domain

One of our email deliverability strategies is to relay mail through different IP addresses based on the domain name of the recipient. This strategy is based on our understanding that many big email providers allow or block sending IP addresses based on the ratio of valid email addresses to bad email addresses (among other criteria). By concentrating all email messages sent by our various bulk email servers (mostly leslie, assata - which provides bulk.mayfirst.org, and morales - which provides Portside) we can earn a good reputation based on sending thousands of legit emails per day.

This strategy allows us to:

  • build a better reputation for any given email provider by combining all sent messages so they originate from one IP address
  • provide flexibility so we can easily redirect messages being blocked on one server to be redirect to a different relay server

How to make a change

Each server that is using this method has a file called /etc/postfix/transport.relay. This file lists all the domains that should be relayed instead of sent by the local server, as well as the domain it should be relayed to.

You can edit this file to add or change entries (this file is not controlled by puppet).

Where to send?

We have two servers configured to relay email:

  • rustin (in Telehouse)
  • cleveland (in XO)

Each of these servers is configured to use a postfix multi instance. That is a method that allows more than one instance of postfix to run on the same virtual server. Each instance sends via a different IP address. The instances are enumerable with the following command (as run on rustin):

0 rustin:/etc/postfix-b# ls -d /etc/postfix*
/etc/postfix  /etc/postfix-a  /etc/postfix-b
0 rustin:/etc/postfix-b#

/etc/postfix is the base instance, and a and b are ones available for use. These are configured via dns as a.rustin.mayfirst.org and b.rustin.mayfirst.org.

Adding more instances

You can add more postfix instances to either rustin or cleveland via puppet. You'll need a free IP address. You can edit either server's .pp file to see existing examples and go from there.

Configuring a server to use the relay farm

  • Edit /etc/postfix/main.cf, adding:
    transport_maps = hash:/etc/postfix/transport.relay
    

Or add this new line to the transport_maps line if it exists already.

Then, run postmap /etc/postfix/transport.relay

Lastly, add the server's IP address to the manifests/global.pp file in puppet.