Re: [Exim] Limit outbound emails per hour on user basis

Página Principal
Apagar esta mensagem
Responder a esta mensagem
Autor: Christian Vogel
Data:  
Para: Yogesh Sharma
CC: exim-users
Assunto: Re: [Exim] Limit outbound emails per hour on user basis
Hi,

On Fri, Dec 12, 2003 at 03:27:55PM -0800, Yogesh Sharma wrote:
> Like if I have a user user1@??? and he can only send 100
> emails. 101th email witin the last hour will bounce to him giving
> specific reason for bounce.


*Warning:* This now is absolutely untested and I have never tried such a
thing!

You could have an ACL with an condition that contains two SQL
statements. The first one (which does not return any value) updates
a database (I think it's at least possible with MYSQL!)

        INSERT INTO mails (user,when) VALUES ('${X}',now())


the other one returns the number of entries in the database in a specific timeframe.

        SELECT COUNT(user) FROM mails WHERE user='${X}' AND when > (now()-3600)


${X} is the category that you are accounting for, for example it would
make sense to use the authentication information of your user:

        ${quote_mysql{$authenticated_id}}


So, probably it's something like that, in the end:

        condition = ${lookup mysql{INSERT...}}\
                ${if >{$lookup mysql{SELECT...}}{100}{yes}{no}}


Chris

--
Christian Vogel -- chris@???