Link to home
Start Free TrialLog in
Avatar of mfuerlinger
mfuerlinger

asked on

mail transfer restriction

Hi
anyone can help me restricting the mail transfer size per mail ?
Not the max. size of the mbox of certain users.
(e.g. max transfer size per mail = 2 MB)

Is there a way to do this individually by user?


I'm using Berkley sendmail 8.9.3-0.1 on SUSE linux box.

Thanks for your help

Mathias
Avatar of samri
samri
Flag of Malaysia image

It is possible to transfer mail that runs thru your sendmail program.    All you need to do is to add the following keywork in your sendmail.cf (most likely to be found in /etc/ or /etc/mail).

O MaxMessageSize=2000000

The figure will be in bytes (2 million bytes).  And yes one would argue 2000000 is not 2MB.  The figure you easily be calculated anyway.

FYI, there is already a PAQ for question similar to this.
https://www.experts-exchange.com/sendmail/Q.20269428.html

Limiting mailbox size would not be quite straightforward.  One option would be storing a mail in a separate filesystem, and imposing user-quota on that specific fs.  

Next alternatives is to hack this code and patch it to check_compat() routine.

http://www.netsys.com/library/sendmail/logall.c 

And again, I am not a C programmer, nor does I know the detail on internal coding of sendmail.  Looking thru the code it looks possible.  Grab a copy and try it out.

Another option to limit mailbox size is, maybe switch to other MTA, PostFix for example.  I never personally tried it, but learn ed somewhere that mailbox size could be controlled.

good luck.

Avatar of mfuerlinger
mfuerlinger

ASKER

The MaxMessageSize flag is only good for general email restriction ?
is there a way to restrict different sizes for different users ?

thanks.

mfuerlinger
I doubt Sendmail has that capability built in by default.  One options for Sendmail is to use libmilter capability.

Or the check_compat() routine should be an option if you prefer to do some hacking.

samri is correct. If you want per-user control of message size you'll have to write your own code to go into check_compat() or into a libmilter filter.
I remember seeing somewhere that Postfix can have control over user mailbox size.  

Perhaps somebody could reconfirm this so that mfuerlinger could have another option.

I have tried to get Postfix up and running - ran into trouble, and decided not to spend more time (yet) on it.

Btw.  As for the mailbox restriction, I would personally might go using different FS for the mailbox spool, and enable userquota on such FS.  There some issues, but it should work.
ASKER CERTIFIED SOLUTION
Avatar of samri
samri
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
to clean this topic
(meanwhile changed from sendmail to postfix.......still configuring)