procmail
[Top] [All Lists]

Re: Attachment filtering (newbie -ish!)

2002-07-08 08:27:43
Simon Powell skribis:

0 B
* ^Content-Disposition: attachment;
* filename=".*\.xxx"
{
     :0 fbw
     |/bin/sed -e 's/\(name=".*\.xxx\)"/\1.txt"/'

     :0 c
     /var/log/XXXattachments.txt
}

Better first check in the headers if there really is 
an attachment coming, or you would search each body 
(and that several times). 

A nested and generalized approach:

  :0
  * does the header mention attachments 
  {
    :0
    * is attachment \.\/(bat|com|exe|lnk|pif|scr|vbs)\>
    {
       :0 fbw
       * MATCH ?? \/...
       |/bin/sed -e 's/\(name=".*\.$MATCH\)"/\1.txt"/'

       :0 c:
       /var/log/$MATCH(_at_)achments(_dot_)txt
    }
  }

Not always are there quotes or brackets around filenames. 

-- 
Affijn, Ruud


_______________________________________________
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>