procmail
[Top] [All Lists]

Re: A recipe does not work for one list only

2005-04-17 09:32:04
On 17 Apr 2005, at 09:23 :02, Hossein Movahhedian wrote:
:0 H

There is a bug with the 'H' flag and it should not be used.

* 
^(From|CC|To)(_dot_)*farsitex-user(_at_)lists(_dot_)sourceforge(_dot_)net(_dot_)*

you don't need the final .*

FTR, I would simply write

* ^TO_:.*farsitex-user@

{
   :0 c:
   | echo "Mail received from: Ftex-user" >> $LOG_FILE

you don't ned a lock file, or a c flag, and I would use LOG instead of echo, but that's personal taste, I think:

:0
* ^TO_:.*farsitex-user@
{
    OLDLOG=$LOGFILE
    LOGFILE=$LOG_FILE
    LOG="Mail Received from ftext-user$NL"
    LOGFILE=$OLDLOG

then this
   :0:
   $LISTS_DIR/.NEW_Ftex-user
}

And the header of an email from this list is:
...
Subject: Re: [ftex-user]FarsiTeX on teTeX
From: "S.M.H. Hamidi" <hamidi(_at_)ce(_dot_)sharif(_dot_)edu>
To: farsitex-user(_at_)lists(_dot_)sourceforge(_dot_)net

the only thing I can think of is are you SURE you're looking at a plain text version of the headers? None of the issues I addressed should prevent the recipe from working. You're going to need to give us a VERBOSE=ON log, although I can guess we'll see a "No Match" line for this list in that log.


There are better ways to do this, btw. Here's my slightly modified version of Sean's sorter:

# Unset LISTNAME, [  ]'s contain a space and tab
LISTNAME
:0
* 9876543210^0 ^(List-Post:[ ]*(<mailto:)?|List-Owner:[ ]* (<mailto:)?owner-)\/[-A-Z0-9_+]+
* 9876543210^0 ^(List-Id:.*<|X-Mailing-List:[   ]*)\/[-A-z0-9_+]+
* 9876543210^0 ^(Sender:[ ]*owner-|X-BeenThere:[ ]*|Delivered- To:[ ]*mailing list )\/[-A-Za-z0-9_+]+
* 9876543210^0 ^Sender:.* List"? <(mailto:)?\/[-A-Z0-9_+]+
{ LISTNAME=$MATCH
}

:0E
* ^Sender:[     ]*\/[-A-Z0-9_+]+-owner
{ LISTNAME=`echo $MATCH | sed -e s/-owner//i`
}

# You can change the following to log however you want.
:0
* ! LISTNAME ?? ^^^^
   LOG="List: $LISTNAME$NL"

   :0fw
   | formail -i "X-my-Listname: $LISTNAME"

   :0: $HOME/lock
   $MLDIR/$LISTNAME/$MYDATE.$LISTNAME

   # if the action failed, probably the directory does not
   # exist, so create it
   :0eW
   {
     LOG="FAILED WRITE$NL"
MAKENEWDIR=`test -d $MLDIR/$LISTNAME || mkdir -p $MLDIR/ $LISTNAME/`

   }

   # Now save the message again
   :0a:
   $MLDIR/$LISTNAME/$MYDATE.$LISTNAME

   # If we get this far, something is quite wrong.
   # Still failed?  Better save the message somewhere we can check it
   :0
   {
     LOG="FAILED WRITE NEW DIRECTORY$NL"
     :0: $HOME/lock
     $MLDIR/FAILED_LIST_SORT

   }
}

This recipe set has the advantage of catching pretty much ANY list message and sorting it. very useful.

--
Try to realize it's all within yourself/No one else can make you change


____________________________________________________________
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