procmail
[Top] [All Lists]

Formail

2006-04-23 11:59:40
One of the users on my system presented me with the following question:

"Would there be any way to make a procmail rule to mark a message as
read if X-Spam-Status: Yes ?"

My first thought was to create a rule in their email program to do so.

Their response: "Thanks. I'm still using OE, and OE filters won't run
on IMAP accounts so that's why I'm looking to do it this way."

A search of Google revealed the following information:
http://comments.gmane.org/gmane.mail.procmail/14284?set_blog_all=yes

"Great!" says I... but not quite... When that is added to the procmail
recipe, none of the messages marked as "X-Spam-Status: Yes" are
delivered.

Using Procmail version 3.2.1 on Mac OS X server 10.3.9 with Postfix
and Cyrus IMAP.

The system-wide procmail file /etc/procmailrc reads as follows:

#
# /etc/procmailrc - System-wide procmail recipes
#
SHELL=/bin/sh
LOGFILE=/var/log/procmail.log  # for testing & troubleshooting
VERBOSE=yes
USER=`echo $USER | /usr/bin/tr A-Z a-z` # force lowercase username
USERINBOX="/usr/bin/cyrus/bin/deliver -e -a $USER -m user/$USER"
INCLUDERC=/Users/$USER/.procmailrc  # allow users to create their own recipes
# if not told otherwise, deliver all messages to the user's inbox
:0w
| $USERINBOX


The User's ~/.procmailrc file reads:

#
# Scan messages for viruses
#
:0fw
| /usr/local/bin/clamassassin
#
# Now, delete any messages with viruses
#
:0:
* ^X-Virus-Status: Yes
/dev/null/
#
# Now, feed any remaining messages to SpamAssassin
#
# The condition line ensures that only messages smaller than 250 kB
# (250 * 1024 = 256000 bytes) are processed by SpamAssassin. Most spam
# isn't bigger than a few k and working with big messages can bring
# SpamAssassin to its knees.
#
# The lock file ensures that only 1 spamassassin invocation happens
# at 1 time, to keep the load down.
#
:0fw: spamassassin.lock
* < 256000
| spamassassin -p /Users/davidl5/.spamassassin/user_prefs
#
# All mail tagged as spam is marked as READ
#
:0fw h
* ^X-Spam-Status: Yes
| formail -I "Status: RO"
#
# All mail tagged as spam (eg. with a score higher than the set threshold)
# is moved to "Spam".
#
:0:
* ^X-Spam-Status: Yes
| $USERINBOX/Spam

The log entry from procmail reads:

procmail: Match on "X-Spam-Status: Yes"
procmail: Executing "formail,-I,Status: OR"
procmail: Executing
"/usr/bin/cyrus/bin/deliver,-e,-a,davidl5,-m,user/davidl5/Spam"

However: The message never arrives in their Spam mailbox. (It never
arrives anywhere, actually.) It's no longer in the Postfix message
queue and never shows up. There are no futher procmail log entries
about this particular piece of mail.

Later, commenting out this (below) does cause the message to be delivered.

:0fw h
* ^X-Spam-Status: Yes
| formail -I "Status: RO"

So it seems to be queued somewhere, but I have no idea where.

I can successfully pipe messages to formail at the command line and
have it correctly output the message with "Status: RO" added.


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