procmail
[Top] [All Lists]

Re: blocking certain attachments

2001-02-13 14:55:01
I found this thread while look for a way to block certain
attachments.

I used the recipe and as long as the user sends from
netscape mail or pine it works, but any user sending the
same attachment from outlook express or outlook, the mail
gets through. Is there something else that needs to be done
to make sure all email programs get filtered out with those
types of attachments?

On Thu, 1 Feb 2001, Takateru Ushiroda wrote:

I'd like to setup procmail to block file attachments with certain
extensions like .vbs, .shs, etc.  How would I do this.  I've checked out

here's a recipe, all credits go to Philip Guenther, I've
just added
extensions I need to filter to his regexp.

# The regexp for matching whitespace in the embedded header
field
# of a multipart message.  We have to handle wrapped lines.
ws = '[         ]*($[   ]+)*'

# The regexp for matching 'anything' inside an embedded
header
# field of a multipart message.  That is, it matches
anything
# except the newline (not followed by a whitespace
character)
# that terminates the header field.
dotstar = '.*($[        ].*)*'

# A single double-quote.  For use in variable expanded
regexps to
# avoid problems related to how procmail implements the
variable
# expansion
dq = '"'

# Any condition that uses any of these variables in a its
regexp
# must have the '$' special before the regexp to tell
procmail to
# do variable expansion on the regexp.

# That matches if there exists a embedded Content-whatever
header field
# whose value, ignoring legal whitespace, matches the regexp
#       .*name="filename"

ext = '\.(scr|vbs|shs|bat|com|exe|pif)'

:0 B
* $
^Content-(Type|Disposition)*:${dotstar}name${ws}=${ws}${dq}.*${ext}${dq}
/dev/null

--
rgds,
serge

-- 
Kimmie Dicaire                         
UNIX/Linux/NT/Novell/Citrix Administrator
http://matrix.linux-help.org
Resume http://matrix.linux-help.org/kimmie
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail