How can I implement "rate limit" in Exim so that every user in my exim can send specific number of emails per day.
List A of Users can send 100 emails per day and the list B of users can send 500 emails per day.
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this communityExpanding on HBruijn's answer, I recommend this ACL segment:
# Keep authenticated users under control
deny authenticated = *
set acl_c_msg_limit=${lookup{$sender_address}nwildlsearch{/etc/exim/send_limits}}
ratelimit = $acl_c_msg_limit / 1d / strict / $authenticated_id
Then you create the /etc/exim/send_limits file and have this in there:
# Commented lines and blank lines are ignored
# Format is EMAIL: LIMIT
user1@domain1.com: 100
user2@domain1.com: 200
user3@domainXX.com: 100
# Must be the last line, this is the default limit
*@*: 50
This is untested, but it should get you headed in the right direction.
The manual has a configuration example for a user based rate limiting setting:
# Keep authenticated users under control
deny authenticated = *
ratelimit = 100 / 1d / strict / $authenticated_id
That restricts authenticated senders to 100 messages per day but which would also be global for all authenticated users.