Indra Satriani

I'm not a geek!

Limit Email Size Per User In Exim

I’ve been searching on google for a while and found very few references regarding this, even in the exim user mailing list. Or its just me whose not lucky enough to get the answer. I finally stumbled on a post in a forum dated few years ago, explaining little script to get what I wanted to do, which hasn’t even been tested before. So I took the liberty to test that script on my working environment production. And now it worked beautifully just as I wanted.

Basically, you only need 2 steps to do this: add the code snippet; and create a file contains a list of users. Put this code inside the router section of your Exim config file:

driver = redirect
domains =
condition = ${if > \

data = :fail: message too big.

Change the domain name and default value according to your need, and if you have a line that says:

message_size_limit = 50M

in your config file, comment that line out, because this could override the value settings in the script above. Save and restart Exim.

Next is to create a /etc/messagelimit file that contains all the users you want to give different size. Example:

user1  10M
user2  20M
user3  30M

This means all the users not listed in this file will only able to send or receive maximum 5MB email include the attachment. No need to restart Exim after adding or removing user to this file. Good luck!


Written by Indra Satriani

October 14, 2011 at 6:51 pm

Posted in linux, tech

%d bloggers like this: