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.


Expanding 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.

  • You can enhance the answer by on the line before the ratelimit, adding a set acl_c_msg_limit=${lookup{$sender_address}nwildlsearch{/etc/exim/send_limits}}, then use that variable in the place of the "100" in your ratelimit. In the /etc/exim/send_limits, have AT THE END of the file "@: 10" (assuming that 10 is a good default). Any other email address, including using wildcards, can be to set the limit to 100 or 200 as he desires. – Todd Lyons Oct 14 '14 at 12:22
  • That makes a much better answer than just leaving it as a comment. – HBruijn Oct 14 '14 at 12:59

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.