Hi All,
I am running Exim with Cpanel/WHM, and I am wondering how to chagne the behavious of exim Discarding message if a user is over the max emails per hour setting, to queue the messages instead. Here is the pertinent code from exim.pl see bolded section specifically.
#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 "Domain $domain has exceeded the max emails per hour. Message discarded.\n";
}
}
How can i change this so that it queued instead of discarded.
Thanks
JohnFrom graeme@??? Tue Apr 07 17:31:46 2009
Envelope-to: exim-users@???
Received: from boom.graemef.net ([82.113.154.29]:36833)
by tahini.csx.cam.ac.uk with esmtp (Exim 4.69)
(envelope-from <graeme@???>) id 1LrED9-0000fk-Sy
for exim-users@???; Tue, 07 Apr 2009 17:31:46 +0100
Received: from cpc1-shep3-0-0-cust909.lei3.cable.ntl.com ([82.5.39.142])
by boom.graemef.net with esmtpa (Exim 4.69)
(envelope-from <graeme@???>)
id 1LrED9-0001SV-6Q; Tue, 07 Apr 2009 17:31:43 +0100
From: Graeme Fowler <graeme@???>
To: John MacKenzie <johnner@???>
In-Reply-To: <F2BA1A5A85EF4C4395857D16485DFD19@JOHN>
References: <F2BA1A5A85EF4C4395857D16485DFD19@JOHN>
Content-Type: text/plain
Date: Tue, 07 Apr 2009 17:31:39 +0100
Message-Id: <1239121899.9179.1.camel@???>
Mime-Version: 1.0
X-Mailer: Evolution 2.24.5 (2.24.5-1.fc10)
Content-Transfer-Encoding: 7bit
X-graemef.net-scankey: boom.graemef.net 1LrED9-0001SV-6Q
6e3d828e078d2e9be684a47fb7d707d2
X-Spam-Score: -1.6 (-)
X-Spam-Status: No, scoreÑ.6 required~0 tests÷LÐ.081,
BAYES_00Ñ.5 autolearnO version^1.8
Cc: exim-users@???
Subject: Re: [exim] How to Change the behaviour of Exim when over max emails
per hour
X-BeenThere: exim-users@???
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: A user list for the exim MTA <exim-users.exim.org>
List-Unsubscribe: <http://lists.exim.org/mailman/listinfo/exim-users>,
<mailto:exim-users-request@exim.org?subject¾subscribe>
List-Archive: <http://lists.exim.org/lurker/list/exim-users.html>
List-Post: <mailto:exim-users@exim.org>
List-Help: <mailto:exim-users-request@exim.org?subjectŽlp>
List-Subscribe: <http://lists.exim.org/mailman/listinfo/exim-users>,
<mailto:exim-users-request@exim.org?subject¥bscribe>
X-List-Received-Date: Tue, 07 Apr 2009 16:31:46 -0000
On Tue, 2009-04-07 at 12:13 -0400, John MacKenzie wrote:
> I am running Exim with Cpanel/WHM
<snip>
> How can i change this so that it queued instead of discarded.
I think you'll be better off asking this question on a Cpanel/WHM list,
because although Exim offers the functionality to use Perl to do Clever
Things, the actual Perl scripts are being provided by someone else.
That said - do you know where in your Exim configuration this is being
called, and could you give us a clue as to that chunk of config? Whether
you can in fact reject, defer or queue rather depends on where the perl
function is called from...
Graeme