procmail
[Top] [All Lists]

RE: Strange problem with the fgrep

2007-05-31 13:57:01
Does anybody know what would be the correct way to compare the body and
a subject of the email with the list of predefine. If there is a match
on one list forward it one address, if there is a match on another list,
forward it to another address. Also, how I can check what actually got
matched (I mean what phrase on the list got matched. Any ideas?

I got this procmail script now. The problem with that script: it always
catches on the first option (list1.lst) regardless of the subject 

:0
* ^FROM_MAILER
{
:0
* $ ? fgrep -i -x -f list1.lst
{
  :0 fwh
  | formail -I"Subject: List 1  ${SUBJ_}"
  :0:mail.lock
  !address1
}

:0
* $ ? fgrep -i -x -f list2.lst
{
  :0 fwh
  | formail -I"Subject: List 2 ${SUBJ_}"
  :0:mail.lock
  !address2
}

:0
* $ ? fgrep -i -x -f list3.lst
{
  :0 fwh
  | formail -I"Subject: List 3 ${SUBJ_}"
  :0:mail.lock
  !address3
}

:0
* ^FROM_MAILER
  {
  :0 fwh
  | formail -I"Subject: Unknown ${SUBJ_}"
  :0:mail.lock
  !address4
  }

}



 

-----Original Message-----
From: procmail-bounces(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
[mailto:procmail-bounces(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE] On Behalf Of 
Bart
Schaefer
Sent: Thursday, May 31, 2007 10:00 AM
To: procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
Subject: Re: Strange problem with the fgrep

On 5/31/07, Alex Kosach <alex(_dot_)kosach(_at_)replacements(_dot_)com> wrote:

:0HB

Don't use HB.  It's the default, and some versions of procmail have a
bug wherein the H flag is never turned off once it's on.

* ^FROM_DAEMON|FROM_MAILER

"^FROM_MAILER" (with the caret included) is the magic token, not just
the string FROM_MAILER.  However, ^FROM_DAEMON should match everything
that ^FROM_MAILER does, so it's redundant here.

{
:0
* $? fgrep -i -x -f $DEFAULT/somelist1.lst

This is not what your log file excerpt says you're executing.  The log
says

Match on "fgrep -is -f /........./somelist1.lst"

The -s option fo fgrep causes some errors to be suppressed, so it may
be causing fgrep to return a zero exit status even when nothing
matched or somelist1.lst was not found.  However, I'd be concerned
that procmail is not using the .procmailrc that you think it's using.


____________________________________________________________
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




____________________________________________________________
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

<Prev in Thread] Current Thread [Next in Thread>