Richard Brinkman
Richard Brinkman

Reputation: 337

rate limiting outgoing e-mails with postfix

I am renting a VPS that blocks outgoing port 25 so that I have to use their relayhost. Which works fine accept for one thing. The relayhost has these restrictions for outgoing mails:

Exceeding these limits either cost more money or result in being banned. I therefore would like to set the same restrictions in my own postfix server in such a way that mails stay in the defer queue if the outgoing limit will be reached. I don't mind that mail is delayed a few hours in order to stay within the limit of the relayhost.

There does not seem to be a postfix setting that will do this out of the box. However for incoming mails there are settings like smtpd_client_recipient_rate_limit and anvil_rate_time_unit that can throttle incoming mails. I was therefore thinking of putting 3 additional smtpd processes in master.cf each of which sets smtpd_client_recipient_rate_limit and anvil_rate_time_unit according to the 3 rate restrictions.

Is this the most practical approach or is there a simpler solution?

Upvotes: 3

Views: 8943

Answers (1)

Stephan
Stephan

Reputation: 581

I ran into a similar issue with my VPS host saying I'm sending too fast. I used the below config to slow the email rate.

default_destination_rate_delay = 5s

This puts a 5 second delay between each outbound smtp connnection to the same destination. There are other default_destination parameters that maybe of use to you on the man page

http://www.postfix.org/postconf.5.html

Upvotes: 4

Related Questions