procmail
[Top] [All Lists]

Re: block Attached files

2000-09-27 15:17:31
gmurad(_at_)unimedsp(_dot_)com(_dot_)br wrote:
so im trying to figure out how to reject, for instance, any incoming/outgoing
messages that has a mp3 or avi files attached..

Incoming, it's possible.  What mime-types do these files have?
They're not "image/jpeg" but how do they come?  I'll assume
"application/mp3" for now; you may want to adjust this....

If in /etc/procmailrc you put

    :0
    * HB ?? ^content-type:.*application/mp3
    { EXITCODE=73 

      :0
      /dev/null
    }

then any mail containing the string "content-type:" (case-insensitive) 
starting at beginning of line, followed by anything, followed by
"application/mp3" on the same line, will get bounced with CANTCREAT
and tossed.  You might want to use a backup file (man procmailex for
example) until you get this debugged.  You might also want to be a
little more precise, e.g.

    BadFile=no
    :0
    * ^content-type:.*application/mp3
    { BadFile=yes }
    :0E
    * ^content-type:.*multipart/mix
    * B ?? ^content-type:.*application/mp3
    { BadFile=yes }

    ...

    :0
    * BADFILE ?? yes
    { 
      EXITCODE=73 

      :0
      /dev/null
    }


Syntax of procmailrc file is in "man procmailrc"

EXITCODE values should be in in /usr/include/sysexits.h

(Is procmail your local delivery agent?  

   grep '^Mlocal' /etc/sendmail.cf         ## does it say "procmail"?   )

-- 
Neither I nor my employer will accept any liability for any problems
or consequential loss caused by relying on this information.  Sorry
Collin Park                         Not a statement of my employer.

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>