This could be, but doesn't have to be a dbmail issue.

I would use postfix's content_filter framework and build a python script to parse the message and get the attachment sizes, lookup the max size in a expanded dbmail table, and either return the message to postfix, of exit with a proper error value.

Just some quick code (incomplete and untested) I ripped out of a disclaimer script I use. Read the FILTER_README in the postfix docs for more info about plugging this into postfix.


#!/usr/bin/python

import email, sys, smtplib, string

MAXPARTSIZE=100000

OUTHOST="localhost"
OUTPORT=10039

EX_TEMPFAIL=75
EX_UNAVAILABLE=69

msg=sys.stdin.read()
sender=string.lower(sys.argv[1])
recipient=string.lower(sys.argv[2])

## check message is incoming (for a my_destination domain)
## get the maxpartsize for this recipient

msg=email.message_from_string(testmsg)
for part in msg.walk():
        if size(part.get_payload()) > MAXPARTSIZE:
                print "Message rejected: attachment too large"
                sys.exit(EX_UNAVAILABLE)

server=smtplib.SMTP(OUTHOST,OUTPORT)
server.sendmail(sender,recipient,msg)
server.quit()

sys.exit(0)




Jesse Norell wrote:
Hello,

  I don't know what the implications are with multiple recipients,
but if a similar field were added for lmtp lookups, it'd be very
efficient, and as you said, would be a feature dbmail had that
others didn't.
  A possible workaround if you're using postfix is to define 2
different transports, each with it's own size= parameter, and
get postfix to lookup the right transport on delivery (ie. you'd
want it to read the value from a database table using the
email address/alias as the key).  There're example config setups
in the list archives here (maybe not for transport table lookups,
but it's almost identical to local_recipient_maps).

Jn


---- Original Message ----
From: James XMS <dbmail@dbmail.org>
To: [EMAIL PROTECTED], DBMail mailinglist <dbmail@dbmail.org>, Micah <[EMAIL 
PROTECTED]>
Subject: Re: [Dbmail] Feature Request. Per User Attachment Quota.
Sent: Mon, 28 Jun 2004 17:53:29 +0000


It would be great if someone could point me in the right direction on how to do
that, or even better integrate it into dbmail so there isn't the slowdown of
spawning a perl script or whatever every time a mail is delivered.

Cheers
James

On Mon, 28 Jun 2004 15:43 , Micah <[EMAIL PROTECTED]> sent:


I understand now, it's a mail size limit on a user level, not a system wide limit.. Sorry.. I'm sure you can do that now with dbmail if you pipe things through a custom script. You could write a perl script or something that would send a rejection note if the mail was too big, otherwise it would just deliver it.
-Micah

On Monday 28 June 2004 10:37 am, James XMS wrote:

I'm not sure i understand what you mean exatly, but my problem is that the
managing directors of my company want to be able to recieve mails of up to
15mb, whereas standard users should only be able to receive mails of up to
3mb.

Cheers
James

On Mon, 28 Jun 2004 15:25 , Micah [EMAIL PROTECTED]> sent:

Not to be a stick in the mud, but why not just limit the overall size of
the email? You're not likely to get a 1megabyte email with no
attachments. This is what I do, but I'll admit I don't know the
particulars of your situation.

Just curious,
-Micah

On Monday 28 June 2004 10:08 am, James XMS wrote:

Hi All,

I have recently come to a situation where i need to set incoming
attachment size limits  for managers/users within my company.

After speaking to postfix guru's everyone came to the decision that
there was no way to do it at MTA level.

Therefore, i would like to make a feature request that dbmail could
check attachment sizes on incoming mail against a field in the dbmail
database for a user and accept/reject the mail accordingly.

Let me know what you all think, because i believe that this is one of
those little things that could set dbmail in a class of its own ( not
that its not already :) ).

Cheers
James

--- Msg sent via @Mail - http://atmail.nl/
_______________________________________________
Dbmail mailing list
Dbmail@dbmail.org
https://mailman.fastxs.nl/mailman/listinfo/dbmail

--- Msg sent via @Mail - http://atmail.nl/
_______________________________________________
Dbmail mailing list
Dbmail@dbmail.org
https://mailman.fastxs.nl/mailman/listinfo/dbmail



--- Msg sent via @Mail - http://atmail.nl/
_______________________________________________
Dbmail mailing list
Dbmail@dbmail.org
https://mailman.fastxs.nl/mailman/listinfo/dbmail


-- End Original Message --


--
Jesse Norell

[EMAIL PROTECTED] is not my email address;
change "administrator" to my first name.
--

_______________________________________________
Dbmail mailing list
Dbmail@dbmail.org
https://mailman.fastxs.nl/mailman/listinfo/dbmail


--
  ________________________________________________________________
  Paul Stevens                                         [EMAIL PROTECTED]
  NET FACILITIES GROUP                     GPG/PGP: 1024D/11F8CD31
  The Netherlands_______________________________________www.nfg.nl

Reply via email to