webgrrls(_at_)xsite(_dot_)net writes:
Thanks to everyone who has sent me helpful replies so far!
I was just browsing the procmailex man page, and saw this:
If someone sends you a mail with the word `retrieve' in the subject, the
following will automatically send back the contents of info_file to the
sender. Like in all recipes where we send mail, we watch out for mail
loops.
:0
* !^From +YOUR_USERNAME
* !^Subject:.*Re:
* !^FROM_DAEMON
* ^Subject:.*retrieve
| (formail -r ; cat info_file) | $SENDMAIL -oi -t
Isn't this really what I'm trying to do? Since I am searching for a
subject line of:
[admin] subscribe
my recipe would look like this:
* !^From +webgrrls
* !^Subject:.*Chicago Webgrrls Listserv FAQ
* !^FROM_DAEMON
* ^Subject:.*[admin] subscribe
| (formail -r ; cat info_file) | $SENDMAIL -oi -t
Does the * in "^Subject:.*[admin] subscribe" act like a wild card, or does
it have another function here? i.e. the recipe as above would catch and
reply to messages with "Re: [admin] subscribe" in the subject line? Since
I would not want this to happen, could I delete the *?
Your recipe does not work as expected, because [admin] is a class
containing 5 single characters. That part of the condition would only
match "a subscribe", "d subscribe" ... and so on. If you want to match
literal square brackets, you need to escape '[' and ']':
* ^Subject:.*\[admin\] subscribe
'*' all by itself does nothing, it's a repetition operator. But the
preceding '.' in conjunction with '*', matches any sequence of zero
or more characters exept newline, potentially including "Re: ".
You could just add another condition to above recipe to prevent
replying to any "Re: " messages:
* !^Subject:.*Re:
Or use
* !^Subject:.*Re: \[admin\]
to specifically filter on "Re: [admin]" messages.
Another usually good idea is to make sure that the words in the Subject:
are matched on word boundaries, to avoid a match on a Subject: line like
"Message for list[admin] subscribers only" (stoopid example, I know ;).
This can be done using procmails special \< \> delimiters, so that the
whole recipe now reads
* !^From +webgrrls
* !^Subject:.*Chicago Webgrrls Listserv FAQ
* !^FROM_DAEMON
* !^Subject:.*Re:
* ^Subject:(.*\<)?\[admin\] subscribe\>
| (formail -r ; cat info_file) | $SENDMAIL -oi -t
Can't say whether using "!^From +webgrrls" or an X-Loop: header should be
the prefered method. I suppose it doesn't normally make a difference in
terms of efficiency.
HTH.