procmail
[Top] [All Lists]

Re: does procmail always use ~/.procmail

2008-12-06 16:41:05
On 6-Dec-2008, at 11:42, LuKreme wrote:
No. Procmail always uses procmailrc and only uses .procmailrc if there was no delivery in procmailrc.

It is trivial to check for a .procmailrc's existence though, and then bypass the rest of your procmailrc.

Now that I am home on my computer, here is what I have at the very end of my procmailrc.

:0
* ! ? test -f $HOME/.procmailrc
{
  LOG="User has no procmailrc LOGNAME=$LOGNAME(_at_)$HOST HOME=$HOME$NL"
  :0 fw
  | /usr/local/bin/spamc -u $LOGNAME

  DROPPRIVS=YES

   :0
   * ^X-Spam-Status:(.*\<)?Yes
   {
      :0 fw
      | formail -I "Status: RO"

      :0: $HOME/lock.$PID
      * ? test -f $HOME/Mail/SPAM
      $HOME/Mail/SPAM
   }

   :0:
   $DEFAULT
}
LOG="User $LOGNAME(_at_)$HOST has a .procmailrc, processing...$NL"

If someone does NOT have a procmail, the message is parsed for spam, and if it is spam, the messages is marked as read and deposited in a SPAM mailbox, otherwise deposited in $DEFAULT.

Otherwise, the fact they have a procmail is logged and that's the end of the procmailrc, so the .procmailrc is loaded. There is no need to SWITCHRC or add an extra DROPPRIVS, privs are dropped when procmail switches to the .procmailrc, and it switches to that on its own.

You do need the DROPRIVS I have before the message is delivered.

BTW, if you are using Maildir for message storage, that Status header will not work. I use:

{ TRAP='mv $LASTFOLDER ${LASTFOLDER}:2,S' }

to mark messages as read for Maildir accounts.



--
Don't congratulate yourself too much, or berate yourself either.
        You choices are half chance; so are everybody else's.

____________________________________________________________
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