
mailinglists at net-virtual
Dec 16, 2004, 6:02 PM
Post #16 of 26
(6919 views)
Permalink
|
|
Re: Is there a way to control the delivery rate?
[In reply to]
|
|
Richard, Thank you very much! I hadn't thought about resolving this problem in the way you suggested (replacing qmail-remote), I think this is a really great solution -- thank you so much! - Greg >On Fri, 2004-12-17 at 10:17, Net Virtual Mailing Lists wrote: >> The reason I need to do this is because we deliver messages to a Yahoo >> group and if your delivery rate is "too high" they flag the email address >> as being an auto responder and stop delivering messages. Frankly, I >> think their solution to this problem is pretty dumb, but I doubt they are >> going to change anything for my benefit... ;-) We also have a MSN group, >> which employs a similar mechanism (although even more conservative). > >Haven't noticed this with our servers, might have a closer look >at the logs. Agreed that it seems stupid. > >One way to do this is to wrap qmail-remote with a rate limiter. >Move qmail-remote to qmail-remote.orig and install the script >below as qmail-remote. Create the directory control/lastdelivery >and set its ownership to qmailr. control/remoteratelimit contains >config info, colon separated domain name and minimum seconds >between deliveries. As a side effect, setting the seconds to zero >will serialize mail to the domain. > >#!/usr/bin/perl > >use Fcntl ':flock'; > >$domain = lc $ARGV[0]; > >if (open(FD, "</var/qmail/control/remoteratelimit")) { > %ratelimit = map { s/[\r\n]+//; (split(/:/))[0,1] } <FD>; > $^F = fileno(FD); > close(FD); >} > >if (defined($ratelimit{$domain})) { > $file = "/var/qmail/control/lastdelivery/$domain"; > $exists = -s $file; > if (open(FD, "+<$file") || open(FD, "+>$file")) { > if (!flock(FD, LOCK_EX|LOCK_NB)) { > print "ZUnable to acquire lock\0"; > exit 0; > } > if ($exists && time < (stat(FD))[9] + $ratelimit{$domain}) { > print "ZRatelimit exceeded\0"; > exit 0; > } > print FD scalar localtime; > } >} > >exec "/var/qmail/bin/qmail-remote.orig", @ARGV; > > >Rick. > >
|