On 11/24/2010 7:17 AM, Stan Hoeppner wrote:
Avinash Pawar // Viva put forth on 11/24/2010 4:48 AM:
Hi,

I want to put throttling in postfix.

Throttling can be of two types :

1. Domain wise throttling (i.e. postfix should sent only 10 mails to
gmail.com and 20 to yahoo.com at a time)
2. On hour basis throttling (i.e. postfix should sent only 10000 emails in 1
hour)

Is it possible to have such feature in postfix?
Read these:

http://www.postfix.org/postconf.5.html#default_destination_rate_delay
http://www.postfix.org/postconf.5.html#transport_destination_rate_delay
http://www.postfix.org/postconf.5.html#transport_destination_concurrency_limit

To accomplish your goals you will need to create multiple smtp servers
in master.cf, one for each destination domain you wish to rate limit,
specifying the appropriate parameters with "-o ".  You will then create
entries in transport_maps specifying that mail destined for each domain
is relayed through the appropriate smtp server you defined in master.cf.

I don't believe you can specify "limit to X emails per hour" but you can
specify the delay period between messages.  Applying simple math will
get you the approximate limit per hour you desire.  For instance, if you
want to limit to 600 deliveries per hour to Google you would set

-o transport_destination_rate_delay = 16s

It's worth noting that transport_destination_rate_delay is implemented in qmgr and not the smtp client. Therefore, specifying "-o" is worthless in master.cf for a smtp client entry.
You should, instead, put such a line in main.cf. e.g.:
slowdown_destination_rate_delay = 16s

And match the transport in master.cf:

slowdown         unix  -       -       n       -       -       smtp

for your Google smtp server in master.cf.  You will not likely achieve a
hard limit, but you can get relatively close with this method.

This has been covered here before in more detail.  You may wish to
search the list archives.


Reply via email to