Postfix Message Size Limit

Michael Leupold leupold at leunet.de
Wed May 17 14:32:33 CEST 2006


Hi,

Am Mittwoch, 17. Mai 2006 12:20 schrieb Blessing Chisvo:
> I have a slow internet connection and would like to set-up postfix to:
> 3.	limit local email to 8mb

you could set a message_size_limit accordingly. However this will limit all 
mail (local and from the internet) to be rejected if bigger. However, 
depending on how the mail gets on your system you can configure the 
message_size_limit per transport in master.cf, please have a look at the 
manpages for reference [master(5),postconf(5)].

For example, I get my mail via fetchmail delivered to localhost:25. In 
master.cf I could then replace
25	inet	n	-	n	-	-	smtpd
by
localhost:25	inet	n	-	n	-	-	smtpd
<myip>:25	inet	n	-	n	-	-	smtpd
	-o message_size_limit=8388608

results:
mails delivered to <myip>:25 (from the clients) are rejected if bigger than 
the limit, mails delivered to localhost:25 (from fetchmail) aren't checked 
for size. Though this would only apply to my setup it might serve as a 
starting-point.

Alternatively you could probably plug your size checking into the policy 
service provided by kolab. Have a look at /kolab/etc/kolab/kolab_smtpdpolicy. 
The policy service is quite an easy concept. Upon mail handling, the service 
(kolab_smtpdpolicy) gets a request of a specified form, listing amongst 
others message size. The service can evaluate the parameters and returns a 
simple response of the form:
action=SOME_ACTION
[empty line]

Have a look at the script and http://www.postfix.org/SMTPD_POLICY_README.html 
for further information.

> 1.	limit all email above 2mb from being relayed to the outside world
> 2.	deliver/relay email between 1mb and 2mb after hours

I think you can also do this via the policy service. It seems you can specify 
a reply of the form action=HOLD to hold the message. Then later you can 
call "postfix flush" via cron and it gets rechecked (this time it is 
permitted).

Well, I'm not actually an expert on postfix, but your question looked 
interesting, so I tried to dig something up. I hope the information I gave 
you is correct - maybe it at least serves as a starting point.

Regards,
Michael




More information about the users mailing list