Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Domain Specific maximum limit for emails

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

  1. shameer

    shameer Registered

    Joined:
    Dec 1, 2003
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    151
    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,460
    Likes Received:
    21
    Trophy Points:
    463
    Location:
    Go on, have a guess
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice