procmail
[Top] [All Lists]

Re: Filtering MS-Office Attachments

2009-07-08 11:53:54
ws='[    ]*($[   ]+)*'
# Double quote
dq='"'
# End of line
eol='$'
# Microsoft Office file name extensions
ext='(doc|xls|ppt|exe)'
# Resend mail to sender
TO=`formail -rtzxTo:`

# Filtering attachments
:0
* 2147483647^0 $ 
^content-type:${ws}(multipart/(mixed|alternative))|(application/)
* 2147483647^0 $ 
^content-disposition:${ws}attachment;${ws}.*name${ws}=${ws}${dq}.*\.${ext}(\..*)?${dq}${ws}${eol}
* 2147483647^0 $ ^content-transfer-encoding:${ws}base64
* ! ^X-Loop: goebel(_dot_)thomas(_at_)gmx(_dot_)net
{
         :0 c
         * ^TO.*goebel.thomas
         local/maildir

         :0
         | echo "Mail with attachment received! $(date) $TO" >> ~/proctest 
}

I am using this code for filter MS-Office attachment and to send an
automatic reply mail. Today i noticed that this recipe also matches on
PDF-Documents? Any idea why? The recipe is OK if all four "*" lines are
fullfilled, isnt it? So, if there is an attachment named name=file.pdf
it should not match this line? But it does!

Thanks,
Tom
____________________________________________________________
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