Limit outgoing number of messages in postfix

Discussion in 'Server Operation' started by pesale86, Nov 18, 2009.

  1. pesale86

    pesale86 New Member

    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?
  2. topdog

    topdog New Member HowtoForge Supporter

  3. pesale86

    pesale86 New Member

    Thanks a lot :)
  4. useo6

    useo6 New Member

    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::preFork" 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
  5. falko

    falko Super Moderator ISPConfig Developer

    You can open a Perl shell...
    perl -MCPAN -e shell
    ... and install the module as follows:
    install Net::Server::PreFork
    afterwards to leave the Perl shell.
  6. useo6

    useo6 New Member

    works great, thanks :)
  7. useo6

    useo6 New Member

    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 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?
    Last edited: Jul 18, 2010

Share This Page