procmail
[Top] [All Lists]

Re: Filtering MS-Office Attachments

2009-07-02 20:14:38
Thomas =?iso-8859-1?Q?G=F6bel?= writes:
* John Conover <conover(_at_)rahul(_dot_)net> [02.07.2009 20:30]:
Thomas Goebel writes:

i want to add a filter which sends an auto-reply if there are
MS-Office files attached to the mail ...

    :0
    * 2147483647^0 $ 
^content-type:${ws}(multipart/(mixed|alternative|application|signed|encrypted))|(application/)
    * 2147483647^0 $ 
^content-disposition:${ws}attachment;${ws}.*name${ws}=${ws}${dq}.*\.${ext}(\..*)?${dq}${ws}${eol}
    * 2147483647^0 $ ^content-transfer-encoding:${ws}base64
    { MALICIOUS=true }

That works for me thanks! I just changed the line from you to:

      ext='(doc|xls|ppt|exe)'

But if i a change {MALICIOUS...} to

| formail -r -k | msmtp -t -a account < $HOME/.mailreply

Maybe try:

    FROM=`formail -rzt -xTo:`

or:

    FROM=`formail -rz -xTo:`

(depending on which address, the trusted, i.e., the "Return-Path:", or
"From", or user supplied, i.e., the "From:" or "Reply-To:", you want
the return mail to go to,) at the top of the MS detection script,
then:

    | msmtp "${FROM}" -a account < $HOME/.mailreply

(I'm guessing on the syntax of the msmtp email address argument.)

     John

-- 

John Conover, conover(_at_)rahul(_dot_)net, http://www.johncon.com/
____________________________________________________________
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