procmail
[Top] [All Lists]

Re: filtering messages "from" someone

1998-02-12 12:13:08
Excerpts from mail: (12-Feb-98) filtering messages "from" someone by Felicia 
Griffin
here is a sample of what i have in my procmailrc file, is there something
that i am doing wrong here?

:0
* ^From: .* gordy(_at_)(_dot_)*
montage

That's trying to match a message that has a header line that starts with
"From:", followed by a space, zero or more characters of any type, another
space, "gordy@" and zero or more characters of any type. The reason why it
isn't matching the messages you think it should is probably because you have
a space both before and after the first ".*". Most of the time there's only a
single space between the colon and the beginning of the person's e-mail
address. Also, sometimes the person's name may precede his or her e-mail
address, and sometiems the e-mail address may be inside of angle brackets
("<...>"). You might want to also look for e-mails that have been
"Resent-From:" the person in question. To maximize matching under all those
circumstances, here's what I suggest:

:0:
* ^(Resent-)?From:.*\<gordy@
montage

I've add a local lockfile (that's the colon after ":0"). You should always
specify a local lockfile to prevent mailbox corruption caused by multiple
e-mails being received at the same time *unless* the thing you are delivering
to is a directory instead of a file. (If "montage" is a directory, leave the
second colon out.) Also, "\<" is a special procmail symbol that matches only
non-word characters. (See `man procmailrc' for details.) It's there to
prevent matching someone whose e-mail address is, for example, "bgordy" when
all you want to do is match "gordy". You should also note that there is no
".*" at the end of the regular expession that I've suggested. Such a thing is
almost always unnecessary (unless you are using the procmail MATCH operator)
and should be left off for reasons of efficiency.

Later,
Ed

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