[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Procmail setup problem



Incoming from Lorenzo Rossi:
> 
> i was trying to setup procmail to store incoming e-mails to different
> files in my home directory, but, procmail write all my incoming emails
> to the same file, the "mbox" file.
> I can not understand why?
> 
> PATH=$HOME/bin:/usr/bin:/bin:/usr/local/bin:.
> MAILDIR=$HOME/Mail      
> DEFAULT=$MAILDIR/mbox
> LOGFILE=$MAILDIR/Procmail_log_from
> LOCKFILE=$HOME/.lockmail
> 
> :0:                             # Anything from Bugtraq
> * ^To.bugtraq@securityfocus.com
> bugtraq
> 
> :0:
> * ^To:.*debian-user
> *  Cc:.*debian-user
> ${HOME}/Mail/debian-user

It matched the first, then didn't match the second.  They cancel out.
You're also missing the "^" on the Cc: line.
Solution to this is scoring:

:0:
* 1^0 ^To:.*debian-user
* 1^0 ^Cc:.*debian-user
${HOME}/Mail/debian-user

You don't need "${HOME}/Mail/"; all targets are relative to MAILDIR.

procmail has a macro you can use instead of both of those: ^TO should
match "debian-user" when in To: or Cc: (man procmailrc, then "/ MISC").


> procmail: Unlocking "/home/milos94/.lockmail"
> procmail: [20786] Thu Aug 26 18:41:11 2004
> procmail: Assigning "LOGABSTRACT=all"
> procmail: No match on "^To.bugtraq@securityfocus.com"
> procmail: No match on "^To.gnupg-devel@gnupg.org"
> procmail: No match on "^To_nmap-dev@insecure.org"
> procmail: No match on "^To.nmap-hackers@insecure.org    # Anything from
> namp-hacker"
> procmail: No match on "^To.rsbac@rsbac.org              # Anything from
> rsbac"
> procmail: Match on "^To:.*debian-user"
............^^^^^^^^^^^^^^^^^^^^^^^^^^^
> procmail: No match on "Cc:.*debian-user"
............^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I'm susbscribed to multiple debian-* lists.  This separates them all
out into separate folders:

# ------------------------------------
# debian-${MATCH}
#
# !@#$%.  The match operator ("\/") matches whatever the regexp that
# follows it matches.  Possible values are "debian-user", "debian-boot",
# ...
#
:0
* ^X\-Mailing\-List:.*debian-\/[a-z-]*
{
  LOG="debian-${MATCH} - "
  :0:
  IN.debian-${MATCH}
}


-- 
Any technology distinguishable from magic is insufficiently advanced.
(*)               http://www.spots.ab.ca/~keeling 
- -



Reply to: