Results 1 to 4 of 4

Thread: Limit the maximum number of each domain can send out per hour

  1. #1
    Member
    Join Date
    Sep 2003
    Posts
    52

    Default Limit the maximum number of each domain can send out per hour

    Hello,
    I have see the option "The maximum each domain can send out per hour " in "Tweak Settings".
    These feature permit to limit the number of email per hour, but is possible change the limit per day or per week?
    This is my problem... I have some user with 1000-1500 user in mailing list. If I limit on 1500 per hour they cannot send more then 1500 email per hour but can send 1500 per all hour.

    Can I limit to (for example) 10000 email per day?

    Antonello

  2. #2
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,496

    Default

    You can't do that through WHM. It may be possible but would mean trawling through exim.conf/exim.pl etc to find where it's done and then modify the code.
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  3. #3
    Super Moderator This forum account has been confirmed by cPanel staff to represent a vendor. chirpy's Avatar
    Join Date
    Jun 2002
    Location
    Go on, have a guess
    Posts
    13,496

    Default

    Found it in /etc/exim.pl
    Code:
    #logsmtpbw here
       my $now = time();
       $domain =~ s/[^\w\.\-]//g;
    #we just can't trust user input
       my $message_size = Exim::expand_string('$message_size');
    
       if ($domain ne "") {
          my $maxmails = 0;
    
          open(CF,"/var/cpanel/cpanel.config");
          while(<CF>) {
             next if (/^#/);
             s/\n//g;
             my($var,$value) = split(/=/, $_);
             if ($var eq "maxemailsperhour") {
                $maxmails = int($value);
             }
          }
          close(CF);
    
          open(CPM,"/var/cpanel/maxemails");
          while(<CPM>) {
             s/\n//g;
             my($mdomain,$mmax) = split(/=/);
             if ($mdomain eq $domain) {
                $maxmails = int($mmax);
             }
          }
          close(CPM);
    
          if ($maxmails > 0) {
             my $nummailsinhour = readbacktodate("/usr/local/apache/domlogs/$domain-smtpbytes_log");
             if ($nummailsinhour > $maxmails) {
                die "You have exceeded the max emails per hour, your message has been discarded.\n";
             }
          }
    
    
          open(DLOG,">>/usr/local/apache/domlogs/$domain-smtpbytes_log");
          print DLOG "$now $message_size .\n";
          close(DLOG);
          chmod(0640,"/usr/local/apache/domlogs/$domain-smtpbytes_log");
       }
    #end logsmtpbw
    It should be fairly straightforward to modify that to your own requirements. You will have to be careful of /scripts/upcp replacing exim.pl when upgrading.
    Jonathan Michaelson

    Need your cPanel servers secured and tuned?
    cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
    Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
    http://www.configserver.com

  4. #4
    Member
    Join Date
    Oct 2004
    Posts
    18

    Default

    Changing this would require changingthe sub routine

    Code:
    sub readbacktodate {
       my($filename) = @_;
       my($buf);
       my($filepos) = 0;
       my $now = time();
       my $onehourago = ($now - (60*60));  ----> 60*60*24
    i think this would make it run on per day basis

    hope my reply aint too late

Similar Threads

  1. The maximum each domain can send out per hour
    By imagic in forum cPanel & WHM Discussions
    Replies: 9
    Last Post: 08-17-2010, 03:06 PM
  2. Replies: 0
    Last Post: 06-18-2008, 05:40 PM
  3. The maximum each domain can send out per hour
    By HDG in forum cPanel & WHM Discussions
    Replies: 4
    Last Post: 07-26-2007, 03:31 PM
  4. The maximum each domain can send out per hour
    By tambo in forum cPanel & WHM Discussions
    Replies: 1
    Last Post: 06-01-2004, 02:36 AM