RE: [SLUG] procmail problem

From: patrick grantham (pwgrant@cssi-fl.com)
Date: Fri Jul 29 2005 - 21:16:03 EDT


Being a newbie at procmail, I relied on the accuracy of a text book
(Procmail, published by O'reilly.)

Thanks again.

-----Original Message-----
From: slug@nks.net [mailto:slug@nks.net] On Behalf Of Paul M Foster
Sent: Thursday, July 28, 2005 5:09 PM
To: slug@nks.net
Subject: Re: [SLUG] procmail problem

On Thu, Jul 28, 2005 at 03:52:08PM -0400, patrick grantham wrote:

> The script below is a global procmail script:
> VERBOSE=1
> LOGFILE=/var/log/procmail.log
> :0H
> * [adv]|<adv>|{adv}|(adv)
> LOG="Trapped msg labeled explicitly labeled as spam"
> /var/spool/mail/spam
>
>
> The log file (/var/log/procmail.log ) shows:
> procmail: Match on "[adv]|<adv>|{adv}|(adv)"
> procmail: Assigning "LASTFOLDER=LOG=Trapped msg labeled explicitly labeled
> as spam"
> procmail: Opening "LOG=Trapped msg labeled explicitly labeled as spam"
> procmail: Error while writing to "LOG=Trapped msg labeled explicitly
labeled
> as spam"
> procmail: Skipped "/var/spool/mail/spam"
>
> First, the mail slips through to the user and not appended to the file
> /var/spool/mail/spam
> Second the "Trapped msg" text is not appended to the file
> /var/log/procmail.log
> Third, other regexps in the procmail file have hits, but no log messages
are
> written.
>
> I don't understand why. Suggestions?

First, the log entry can't go between the '*' line and the disposition
line. Procmail expects the next line after what it's looking for to be
the place where it's going. Because of the way you've written it,
procmail thinks this whole "LOG="Trapped..." is some sort of file name,
and is trying to open and write to it. Failing that, it's simply falling
through to its default destination. Notice the log message said it was
trying to open "LOG="Trapped...". Try putting the "LOG" line above the
actual recipe. I've never tried to change the log file entry for a
specific email, nor do I see any documentation on doing it. If it
doesn't work, you might try adding a header like "X-SPAM=..." to the
email itself. This will probably also get appended to the log file as
well in the course of processing the email.

Second, your :0H line should have a colon at the end of it, like :0H:.
Without that, the file locking mechanisms of procmail won't operate.
Putting the colon there forces procmail to attempt to lock the
/var/spool/mail/spam folder before writing to it, which is an
exceptionally good thing in multi-user environments.

Third, the "H" in your :0H line has no effect. If you look at man 5
procmailrc, you'll see that putting a capital H here tells procmail to
egrep the header. But it also says that's the default action. You could
leave it without harm, but it's really just fluff.

> PS
> Procmail seems nearly as cantankerous as autolisp!

It's really pretty easy once you get the hang of it. But the syntax is
very precise.

Paul
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 18:39:03 EDT