The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How does the new Max Emails per Hour tracking work ?

Discussion in 'E-mail Discussions' started by yapluka, Nov 28, 2007.

  1. yapluka

    yapluka Well-Known Member

    Joined:
    Dec 24, 2003
    Messages:
    301
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    France
    cPanel Access Level:
    Root Administrator
    I can see that the max email per hour tracking changed but how is it working now ?
    I've added domain.com=NNN to /var/cpanel/maxemails then run /scripts/build_maxemails_config and found that domain.com=NNN is no longer in /var/cpanel/maxemails.

    Also what are the new folders /var/cpanel/maxemailsperdomain/ and /var/cpanel/maxemailstracker/ for ? They're still empty after running the script...
    And where do I check the domains allowed to send more emails than the server wide limit ???

    Is this new system documented somewhere ?
    Thank you !
     
  2. borealphil

    borealphil Member

    Joined:
    Oct 21, 2005
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Hi
    why don't I have the
    /scripts/build_maxemails_config
    and
    /var/cpanel/maxemailsperdomain/ and /var/cpanel/maxemailstracker/

    files on my server? I use WHM 11.11.0.

    Thanks!
    Phil
     
  3. yapluka

    yapluka Well-Known Member

    Joined:
    Dec 24, 2003
    Messages:
    301
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    France
    cPanel Access Level:
    Root Administrator
    I forgot to add that I'm using the Current tree and this new system came up last night with the version 18151 :)
     
  4. yapluka

    yapluka Well-Known Member

    Joined:
    Dec 24, 2003
    Messages:
    301
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    France
    cPanel Access Level:
    Root Administrator
    Nobody knows ? cPanel staff, should I open a ticket ?
     
  5. kirkmiesle

    kirkmiesle Member

    Joined:
    Jan 18, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    OHIO
    Yes, I would like to know how this works, too.. I did the same thing but the per domain setting doesn't seem to be sticking.

    Kirk
     
  6. nithintou

    nithintou Member

    Joined:
    Dec 22, 2006
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    open up file :
    /scripts/cPScript/EmailTracker.pm > find line : 59

    replace

    Code:
    my ( $name, $value ) = split( /=/, $_, 2 );
    with:

    Code:
    my ( $name, $value ) = split( /=/, $line, 2 );


    I hope someone fixes this in the releases as well. :)


    .
     
  7. yapluka

    yapluka Well-Known Member

    Joined:
    Dec 24, 2003
    Messages:
    301
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    France
    cPanel Access Level:
    Root Administrator
    Brilliant, nithintou !!!

    I had submitted a ticket at cPanel support and I'm going to update it and point them to your post.

    Thank you soooo much :)
     
  8. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,381
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Is there any documentation as to how this new system works?

    If we want to increase the sending limit for a specific account, do we still just add that domain to /var/cpanel/maxemails?
     
  9. scottc

    scottc Well-Known Member

    Joined:
    Apr 21, 2002
    Messages:
    48
    Likes Received:
    0
    Trophy Points:
    6
    I would like to know this too. It looks like cpanel wiped out the maxemails file on all of our servers, so now we have to wait for customers to complain about bounced mail to find out who needs a higher setting. I need to know how to prevent that from happening again.
     
  10. Metro2

    Metro2 Well-Known Member

    Joined:
    May 24, 2006
    Messages:
    376
    Likes Received:
    10
    Trophy Points:
    18
    Location:
    USA
    cPanel Access Level:
    Root Administrator
    To add insult to injury, when the new maxemails files get created, they're not going back to zero after an hour. Once the customer hits their limit per hour, it gets "stuck"' there and they can't send out any more until we delete their maxemailtracking file.
     
  11. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,381
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    I'm not sure if this new system went through a real good testing procedure.

    It would appear that when using POP-before-SMTP, whatever account is last checked via POP, that account gets incremented as sending out mail. I'm not sure if this is the intended set up or not.

    If you have two accounts on a server, bulkmailer.com and regularmailer.com, if the default setting on your server is to send 100 messages per hour, but you increase bulkmailer.com to 500 messages per hour. Then if someone checks a regularmailer.com POP account, and sends out messages as bulkmailer.com, then all of those messages increment the counter for regularmailer.com. At least this is what I have come across with my investigation of this. I'm not sure if this is an intended set up. It looks to be misplaced if you ask me, but perhaps I am missing something.

    I'm just really curious as to what was wrong with the old system? The old system seemed to work. The only downside I saw was that /usr/local/apache/domlogs/domain.com-smtpbytes_log did not reset each month, meaning that these files grew in size over the life of the account.

    With the seemingly lack of documentation on this new "feature" and a growing number of complaints concerning how well it works, would it just be possible to go back to the old tracking system?
     
  12. nithintou

    nithintou Member

    Joined:
    Dec 22, 2006
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I think this feature is pretty good and need just a bit more of tweaking.
    A third setting independent of maxemails to check if the server admin wants to set max emails to individual users or not should be good enough.
    I have found this setting pretty useful on our servers.Having set the default max email count to really low and reasonable value, we raise it for just the legit bulk mailers.

    That is actually how its supposed to work. If someone else is mailing from theirdomain.com as yourdomain.com, its definitely not you who has to pay for it.
     
  13. Nick

    Nick Member

    Joined:
    Dec 27, 2001
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    I have the new problem with this feature
    my server has the server wide limit 100 msgs per hour
    some trusted domain blabla.com has the custom limit 1000 msgs per hour
    and the corresponding file /var/cpanel/maxemailsperdomain/blabla.com is present and has the correct value - 1000
    but user still cant send more them 100 mails and get errors like
    "Domain blabla.com has exceeded the max emails per hour (100) allowed. Message discarded."
    any idea ?
     
  14. ckh

    ckh Well-Known Member

    Joined:
    Dec 6, 2003
    Messages:
    356
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Phoenix, AZ
    cPanel Access Level:
    DataCenter Provider
    I have the same problem that I posted about in new thread:

    http://forums.cpanel.net/showthread.php?t=74794&highlight=maxemails

    No answers there yet though.

    http://bugzilla.cpanel.net/show_bug.cgi?id=6256
     
    #14 ckh, Jan 8, 2008
    Last edited: Jan 8, 2008
  15. tangowebs

    tangowebs Well-Known Member

    Joined:
    Oct 12, 2004
    Messages:
    93
    Likes Received:
    0
    Trophy Points:
    0
    Same problem here...I would like to know a solution...
    I executed the script /scripts/fixeverything but didnt solve.
     
  16. nithintou

    nithintou Member

    Joined:
    Dec 22, 2006
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    just fixing a couple of bugs in the maxemails tracking...dunno if this fixes it for everybody:

    open file :
    /scripts/cPScript/EmailTracker.pm > find line : 46

    replace
    Code:
     if ( !-e '/var/cpaenl/maxemailstracker' ) {
    with
    Code:
    if ( !-e '/var/cpanel/maxemailstracker' ) {
    open file:
    /etc/exim.pl.local > find line : 337

    replace
    Code:
    sub getmaxemailsperhour {
        my $domain = shift;
        open( my $max_fh, '<', '/var/cpanel/maxemailsperhour' );
        my $maxmails = int readline($max_fh);
        close($max_fh);
    
        if ($maxemails != 0) {
            if (-e '/var/cpanel/maxemailsperdomain/' . $domain) {
                open( my $max_fh, '<', '/var/cpanel/maxemailsperdomain/' . $domain );
                $maxmails = int readline($max_fh);
                close($max_fh);
            }
        }
        return $maxmails;
    }
    with
    Code:
    sub getmaxemailsperhour {
        my $domain = shift;
        open( my $max_fh, '<', '/var/cpanel/maxemailsperhour' );
        my $maxmails = int readline($max_fh);
        close($max_fh);
    
        if (-e '/var/cpanel/maxemailsperdomain/' . $domain) {
            open( my $max_fh, '<', '/var/cpanel/maxemailsperdomain/' . $domain );
            $maxmails = int readline($max_fh);
            close($max_fh);
        }
        return $maxmails;
    }
    
     
    #16 nithintou, Jan 9, 2008
    Last edited: Jan 9, 2008
  17. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,381
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    nithintou your post was very helpful. I believe I have identified the exact location that is causing problems.

    I was able to duplicate this issue in a controlled environment. I noticed that when I made the changes you recommended to the exim.pl.local file that this resolved the issue, but I wasn't exactly sure why.

    A closer look.

    Look at the code in the getmaxemailsperhour subroutine. Specifically the the maxmails is assigned and checked.

    Code:
    my $maxmails = int readline($max_fh);
    and

    Code:
    if ($maxemails != 0) {
    Notice that one variable name is $maxemails and the other is just $maxmails. This is the problem.

    The section:

    Code:
    if ($maxemails != 0) {
    Needs to be changed to:

    Code:
    if ($maxmails != 0) {
    The entire subroutine would look like:

    Code:
    sub getmaxemailsperhour {
        my $domain = shift;
        open( my $max_fh, '<', '/var/cpanel/maxemailsperhour' );
        my $maxmails = int readline($max_fh);
        close($max_fh);
    
        if ($maxmails != 0) {
            if (-e '/var/cpanel/maxemailsperdomain/' . $domain) {
                open( my $max_fh, '<', '/var/cpanel/maxemailsperdomain/' . $domain );
                $maxmails = int readline($max_fh);
                close($max_fh);
            }
        }
        return $maxmails;
    }
    I have tested this and this seems to work. Even where I was able to duplicate this problem, applying the above changes fixed this issue.

    Again props go to nithintou for pointing in the right direction.
     
  18. astopy

    astopy Well-Known Member

    Joined:
    Apr 3, 2003
    Messages:
    165
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Have you informed the cPanel developers of this?
     
  19. sparek-3

    sparek-3 Well-Known Member

    Joined:
    Aug 10, 2002
    Messages:
    1,381
    Likes Received:
    23
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
  20. brianoz

    brianoz Well-Known Member

    Joined:
    Mar 13, 2004
    Messages:
    1,146
    Likes Received:
    6
    Trophy Points:
    38
    Location:
    Melbourne, Australia
    cPanel Access Level:
    Root Administrator
    There's another bug as far as I can see. The files in /var/cpanel/maxemailstracker/* are meant to be formatted as:

    hour.date.month.year=numemailssent

    What's happening is that the call used to build the time for this is using an empty variable $time, so that all the files always have the same time (ie 0), so file entries always look like:

    0.1.0.70=2

    etc etc, with the number after the '=' sign varying. The problem is that accounts will then hit their limits, eventually. (Not sure that I like this way of doing it as I can see an easy way to double my per-hour limit, but it's now the standard)

    The fix is to change the call to gmtime() to use "time" or $now:

    Code:
    [barney:/var/cpanel/maxemailstracker]# diff -c /etc/exim.pl.local.broken /etc/exim.pl.local.fixed
    *** /etc/exim.pl.local.broken   2007-12-02 04:04:41.000000000 +1100
    --- /etc/exim.pl.local.fixed    2008-01-22 12:00:29.000000000 +1100
    ***************
    *** 336,342 ****
          $max_allowed = int $max_allowed;
    
          if ($max_allowed) {
    !         my($hour,$mday,$mon,$year) = (gmtime([COLOR="Red"]$time[/COLOR]))[2,3,4,5];
    
              if (! -e '/var/cpanel/maxemailstracker/' . $domain) {
                  open(my $email_fh,'>>','/var/cpanel/maxemailstracker/' . $domain);
    --- 336,343 ----
          $max_allowed = int $max_allowed;
    
          if ($max_allowed) {
    ! ## NEXT LINE FIXED WDGF Jan 2008 - was using $time instead of time.  should be $now.
    !         my($hour,$mday,$mon,$year) = (gmtime([COLOR="Red"]time[/COLOR]))[2,3,4,5];
    
              if (! -e '/var/cpanel/maxemailstracker/' . $domain) {
                  open(my $email_fh,'>>','/var/cpanel/maxemailstracker/' . $domain);
    
    
    To check whether you have the problem, run "grep gmtime /etc/exim.pl.local". If it comes up with gmtime($time) you have this bug. You can also check the hour and date in the files in /var/cpanel/maxemailstracker and if they're all the same, you have this bug.

    Could someone submit this as a bug?
     
    #20 brianoz, Jan 21, 2008
    Last edited: Jan 21, 2008
Loading...

Share This Page