[Exim] Quota on number of mails sent per day.

Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: Theo Zourzouvillys
Ημερομηνία:  
Προς: exim-users
Αντικείμενο: [Exim] Quota on number of mails sent per day.
Hi,

I can't seem to find anyhting about this anywhere, I've finally gived
up trying to get this working after 3 days. I think I'm missing
something really obvious, or it's not possible :/...

As part of a strong anti-spam/bulk-mail sending policy, we want to
limit all of our users to sending a maximum number of mails per
day/hour/month/whatever. The problem we have in offering free
accounts is that people could, and have signed up to us, send out a
mailshot, then run along somewhere else - we normally manage to catch
them mid-operation, but can't always garuntee it.

I know we are never going to be able to stop spam totally as much as
I try, but there are somethings we can do to help reduce it; We
already limited senders to their registered email address/and or
registered domain(s), which has had a good effect so far.

All of our systems use MySQL backend, so things shouldn't be that
hard - I have 2 columns in a Mail database for each email address,
MailCount and MailLimit, of which I would like just as a mail is sent
our for it to incrememnt by one, then on verification of sender or
when the router gets to do it's bit check to see if that user has
reached their limit, and if so either spam them back, saying sorry
and please contact support to raise the number straight away (that's
the easy bit ;p).

As far as I have manged to get things working so far, after righting
for far too long, this *seems* to sort of work, but not quiet good
enough :

In routers:

check_limit:
    driver = domainlist
    verify_recipient = false
    transport = over_limit
    condition = ${if eq {${perl{check_mail_count}}} {1} {yes} {no} }
    route_list = "*"


lookuphost_real:
    driver = lookuphost
    verify_recipient = false
    verify_sender = false
    condition = ${if eq {${perl{mail_count}}} {1} {yes} {no}  }
    transport = remote_smtp


lookuphost:
    driver = lookuphost
    transport = remote_smtp



The perl sub check_mail_count just sees if they are (a) relaying and
(b) over their limit, and the mail_count actually increments the
count by 1 if they are relaying.

If check_limit succeeds, it just gets sent to an autoreply that
bounces the message.

The problems I can't seem to get my head around are:

1) This doesn't seem to work correctly with the real count of mails
sent, and if a user's limit is set to say 100 mails per hour, they
send 99, then send another 1 cc'ed to 100 people, this system would
allow the mail to get through.

2) It would be nice to tell the client when they enter the MAIL FROM
address they they have reached their limit, but I can't seem to do
this at all.

I'm starting to think this is not really feasable but don't want to
believe it!, any ideas at all would be gratefully recivied.

Thanks,

~ Theo

Theo Zourzouvillys
Global Network Consultant

+ Notnet.co.uk - Quality web hosting at an affordable price
- Notnet Limited t/a Notnet Webhosting
- Registered in England and Wales, company number 4371578.
- Registered office: White House, Wollaton Street, Nottingham NG1
5GF, United Kingdom
- http://www.notnet.co.uk/
+ Mobile: +44 7747 844 300
+ Email: theo@???
+ Personal Website: http://www.zozo.org.uk/
+ Spod: telnet://www.trekkers-rest.com:3000/