procmail
[Top] [All Lists]

RE: Stripping bad attachments

2005-01-20 16:47:16
-----Original Message-----
Google Kreme

On Thu, 20 Jan 2005 16:14:12 -0600, Pettit, Paul 
<ismanager(_at_)ccbnpts(_dot_)com> wrote:
-----Original Message-----
From: Google Kreme [mailto:gkreme(_at_)gmail(_dot_)com]
Sent: Thursday, January 20, 2005 2:04 PM

On Thu, 20 Jan 2005 10:08:04 -0600, Pettit, Paul
<ismanager(_at_)ccbnpts(_dot_)com> wrote:
While that works fine I'd prefer to remove the file
entirely. I've tried
substituting an empty value and substituting all spaces 
for the file
name, but the file is still attached and shows up as an 
attachment.

you need demime (or other simialr tools)

<http://scifi.squawk.com/demime.html>


I've looked into demime and it seems like a nice tool but 
a) there are
no pointers to how to impliment it via a procmail filter 
(i.e. globally)

/etc/procmailrc

:0f
| /path/to/demime

and b) it doesn't strip the attachments it "flattens" them 
into text,

No, it REMOVES all mime attchments and leaves a text only mesage.

" Demime has one specific purpose:  It is designed to take e-mail that
is not plain text, and make it into plain text e-mail. The main area
that it is supposed to function in is the area of mailing list input,
but it also works out of people's maildrop or procmail filters to
strip attachments off of mailing list mail that they get. It also
unconditionally removes all attachments leaving plain text mail."

note the last sentence.


Ah, now I missed that part, thanks.

So would the following selectively "pick off" those emails that have bad
attachments (as defined by me):

:0
*^Content-type: (multipart/mixed|application/octet-stream)
{
    :0 HB
    *^Content-Disposition: (attachment|inline);
    *filename=".*\.(vbs|wsf|shs|exe|chm|pif|vbe|hta)"
    {
       :0f
       | /path/to/demime

       SHELL=/bin/sh
       :0 fhbw
       |/usr/bin/sed \
- -e 's/^Subject:/Subject: **ATTACHMENT REMOVED**/'
    }
}

Thanks for all the help, it's been very refreshing. :)

Paul P.


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail