Is there some good way to limit outbound mail in postfix? Exactly, I want to limit number of send messages by domain per some time interval. Imaginary example: I have email accounts in 3 different domains: tld1, tld2 and tld3. It is not relevant how many accounts in what domain. All accounts in tld1 can send at most 20 messages per hour. All accounts in tld2 can send at most 10 messages per hour. All accounts in tld3 can send at most 25 messages per hour. Does that can be done? And how?
Postfix does not have built in support for rate limiting, you will have to use a policy daemon for that. a good one is policyd http://www.policyd.org/tiki-index.php?page=ModuleFeatures
I followed the instructions of the install-file but I can't get it to work. I always get the following error when I try to start the daemon: Base class package "Net::Server:reFork" is empty. (Perhaps you need to 'use' the module which defines that package first.) at /usr/local/sbin/cbpolicyd line 30 BEGIN failed--compilation aborted at /usr/local/sbin/cbpolicyd line 30. When I try to install "perl-Net-Server.noarch" by using "yum install perl-Net-Server.noarch", yum says that there is nothing to do. OS: CentOS 5.5 64Bit
You can open a Perl shell... Code: perl -MCPAN -e shell ... and install the module as follows: Code: install Net::Server::PreFork Type Code: q afterwards to leave the Perl shell.
Policyd is running, but it seems doesn't work correctly. I created a quota by using the web administration of Policyd with a limit of 1 message/hour (for testing purposes) but I can send and receive as many e-mails as I want. The logfile is also empty (the start sequence is the only entry). It seems that postfix completely ignores policyd. I also added to main.cf which looks like this: Content of policyd logfile: Looking forward to hearing from anyone Edit:\\ It's working - I forgot to activate the quota-limit and I replaced the old version (2.0.8) with the actual version. When I send an email by using thunderbird or outlook it is working correctly. But, when I try sending with the mail()-function of php, I can send as much as I want. Is there any way to limit this function using policyd?