Main menu

Domain based email policy with postfix

As previously discussed in Postix rate limit section that every email provider has it’s own policy for mass mailing or bulk mailing. We can create Domain based email policy with POSTFIX for all top level email providers.  It’s always a best practice to check bulk email send policy for providers. Just search in Google “bulk email sender guideline” for domain and you will find it. Some of popular domain guideline is here..

Before dig diving into configuration let’s know something about transport maps in Postfix. Transport maps is a way to forward your email request to another MTA or smart host. As an example if you want to send google email through different MTA and Hotmail email through different MTA.

What we are going to do with postfix we will create multiple MTA transport in and create a policy for each MTA transport.

Let’s create different MTA transport in

Here we are creating a UNIX socket for different MTA and assigning a name to it. open your /etc/postfix/ file and insert these entry..

gmail unix - - n - - smtp
yahoo unix - - n - - smtp
hotmail unix - - n - - smtp
aol unix - - n - - smtp

Now let’s map your domain name with your transport MTA.

Now we will create a transport map and forward the domain query to particular MTA. Open your /etc/postfix/transport file and add the lines gmail: yahoo: hotmail: aol:

Now let’s create convert this file to Postfix lookup table format

Postfix having it’s own lookup format. You can check supported format on Postfix Documentation.

# postmap /etc/postfix/transport

Now we can add the policy to the file:

Specify the rate limit for different MTA we have created.

transport_maps = hash:/etc/postfix/transport
gmail_destination_rate_delay = 0
yahoo_destination_rate_delay = 2s
hotmail_destination_rate_delay = 1s
aol_destination_rate_delay = 0

Reload your postfix configuration to apply changes.

# systemctl restart postfix

It’s work like when we send any email to a domain it will check the transport maps, forward it to MTA and we can limit the rate on that MTA.