Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want limit the messages which sent through exim per user or per domain. (for now interesting only message sent through php mail).

mails send from apache user (mod_php) so as I understand limit through user is not available, because i have only one user.

I think the better way limit by host. But the other problem it's subdomains.

Advise me how i can fix this.

Also I read about values $authenticated_id,$sender_host_authenticated,$sender_address etc. how I can trace this values?

For now i set limit for any users or hosts:

           deny message = Sender rate overlimit - $sender_rate / $sender_rate_period
           ratelimit = 100 / 1h / leaky

Sorry if question looks like not good, I'm new in server administration. Thanks.


Let's simplify. How I can limit messages to send per each virtual host. Any ideas!


Any ideas...

What about this:

Add to virtual host:

php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f"

And determinatevirtual host from "Return Path"

warn set acl_host  = ${if match{$h_Received:}\
                            {\N Return-path: (Regular expression here) \N}\
       deny message = Sender rate overlimit - $sender_rate / $sender_rate_period
       ratelimit   = 200 / 1d / leaky / $acl_host


I add ITK module to Apache, for now each vhost runing from unique user.

Changing configuration to (with authenticated_id):

               deny message = Sender rate overlimit - $sender_rate / $sender_rate_period
               ratelimit = 100 / 1h / leaky / authenticated_id

The question is, is it enough for full limits for each user? And second question how i can add the white list of users that limit will not work in this example. Thank you.

share|improve this question
What are you trying to do? Are you trying to limit the amount of spam that gets sent through? There are other, better ways of doing that. Are you trying to limit the number of messages sent by your legitimate users? – Ernie Dec 17 '12 at 21:21
Yes, I want prevent spam through my EXIM. I found one way set limits. What another way you can advise me? Thanks. – user1156168 Dec 18 '12 at 22:56

If you want to do this as is, you are going to need to write a custom exim ACL that extracts the sending domain.

Alternatively you can run php via su_php or use mod_ruid2 to run each vhost as a unique user. Or block direct sendmail injection and require all scripts to send email via authenticated SMTP accounts. Then you can use all of the existing available ACLs.

share|improve this answer
Thanks for your answer. Could you tell more how I can extracts the sending domain, just give me direction. – user1156168 Jan 3 '13 at 22:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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