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.

Domain Specific maximum limit for emails

Discussion in 'E-mail Discussions' started by shameer, Jul 27, 2005.

  1. shameer

    shameer Registered

    Joined:
    Dec 1, 2003
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    noticed something useful in /etc/exim.pl

    ===============================================
    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 "Domain $domain has exceeded the max emails per hour. Message discarded.\n";
    }
    }
    =====================================================


    Looks like it checks if there is a maximum limit for outgoing mails set for particular domain. I believe there is no option in main WHM to set this. If this code was like the one below and we have a /var/cpanel/maxemails , cant we
    set maximum out going limit for each domain.


    ****************************************************************************************
    my $nummailsinhour = readbacktodate("/usr/local/apache/domlogs/$domain-smtpbytes_log");

    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);

    if ($maxmails > 0) {

    if ($nummailsinhour > $maxmails) {
    die "Domain $domain has exceeded the max emails per hour. Message discarded.\n";
    }
    }

    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) {
    if ($nummailsinhour > $maxmails) {
    die "Domain $domain has exceeded the max emails per hour. Message discarded.\n";
    }
    }

    **********************************************************************
     
  2. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
Loading...

Share This Page