procmail
[Top] [All Lists]

Fwd: Re: Problems matching attachment and autoreplying.

2002-02-19 01:17:41

I am completely lost with this one, can someone please help to push me in the 
right direction or give me some pointers on how to accomplish the below?

Thanks in advance,

Niklas
--------
On Friday 15 February 2002 20:30, Matt of the Long Red Hair wrote:
All procmail knows is that the call to formail failed for some reason.  I
haven't run a test of your code myself, and just looking at it nothing
immediately jumps out at me as broken, so I'm not sure why.  You might try
running some test messages through that command by hand from the
commandline, and see what happens.

Judging from the way you wrote this out, you indend to only run the formail
line if the message is not written to one of the folders, and you never
want the message to drop off the end and be delivered to $DEFAULT, right?

Sorry for the poor explanation, but I am actually looking to run the formail
line only if there is a match i.e. if written to one of the folders. If there
is not a match, should just continue to next section and next and if no match
whatsoever then deliver to $DEFAULT.

So, to recap, a message comes in, first part checks:
:0 B:

* .*name=.*\.doc
/usr/mailfilters/doc

If match, save to folder (/usr/mailfilters/doc) and generate autoreply and
exit.

If no match, send the message to the second check:
:0 B:

* .*filename=.*\.doc
/usr/mailfilters/doc

If match, save to folder (/usr/mailfilters/doc) and generate autoreply and
exit.

If no match, send the message to the third check.

And next and next and so forth...

If no match at all, then just deliver to $DEFAULT, without generating
autoreply.

How can I do this? (Updated recipe below, formail was fixed by following
Philip Guenther's advice)

Thanks in advance,

Niklas Palmqvist
--------------
LOGFILE=/var/log/procmail
VERBOSE=on
LOGABSTRACT=all
XLOOP=npalmqvist(_at_)shipco(_dot_)com

:0

{

# Get the subject.
SUBJ=`formail -c -xSubject: | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`

# Get the sender.
FROM=`formail -rt -xTo: | sed -e 's/[;\`\\]/ /g' \

         | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`

# Match on name.

:0 B:

* .*name=.*\.doc
/usr/mailfilters/doc

# Match on filename.

:0 B:

* .*filename=.*\.doc
/usr/mailfilters/doc

:0 h

         * ! $ ^X-Loop: *$\XLOOP

         | ( formail -rt -A"X-Loop: $XLOOP" ; \

           echo "Your e-mail was bounced!" \
           ) | sendmail -oi -t

----------------

In order to get that, aside from fixing whatever's wrong with the call to
formail, just remove the c flag from your rules, like so:

# Match on name.

:0 B:

* .*name=.*\.doc
/usr/mailfilters/doc

----------------------------------------------------------------------
``Life moves pretty fast.  If you don't stop and look around once in a
while, you could miss it.''
    -- Ferris Bueller

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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