procmail
[Top] [All Lists]

Re: attach filter

2001-08-01 11:00:26
At 13:37 2001-08-01 +0200, Mailing Manager wrote:

All the thing works less than one: the matching ont he attach with a doc
extension.

:0
* !^FROM_DAEMON
* !^X-Loop: jmymiail(_at_)mydomain
* ^Content-Type: *multipart/mixed
{

This means the actual message header should have a multipart/mixed header.

   :0 fbw
   * ^Content-Type: *application/msword

You should review your use of flags here - the operation you are performing at this level IS NOT a filter, so 'f' isn't appropriate. b feeds the body to the pipe -- it does not restrict the regexp to the body (which you should want to use 'B' for). As you are not actually filtering at this level, the 'w' flag is also inappropriate.

        {

You're missing flags on this inner recipe, so it won't work at all -- and your procmail log should contain an error to that effect ('skipped' on the next lines).

        * ^name*\.[Dd][Oo][Cc].*

You're expecting to match name at the very beginning of the line? You should examine your messages closer - they shouldn't be formatted this way. The '*' after name says "zero or more of the preceeding character", so as written, this will match:

        nam.doc

        name.doc
        nameeeeeeeeeeee.doc


procmail is case insensitive (unless you provide a flag to say otherwise), so the bracketed letters are unnecessary.

The '.*' at the end is unnecessary - and in fact, something you should not want.

I believe you're looking for something similar to (untested):

        :0fw
        * B ?? ^[       ]*name=\".*\.doc\"
        | do_something


There is *NO* guarantee that the name= will come from the same mime attachment as the content type previously matched (consider that the file IS multipart) - you may be better off piping mime messages through an external script to parse the MIME chunks individually. No, I don't have any code sitting around to do this, and I'm not about to write it either.

Nothing to do, it catch the multipart/mixed, and nothing else....

No surprise - there are a lot of errors in this recipe.

Have you considered enabling verbose logging and actually looking at the generated logfile? This should be one of your FIRST recourses when testing a new filter. See the URL in my .sig for more info.

---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

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