procmail
[Top] [All Lists]

Re: whitelists based on domain only

2003-11-19 17:05:46
Toen ik Vicki Brown kietelde, kwam er dit uit:

  :0 H
  * ^From:.*(tidbits.com|wordsmith.org|yahoogroups.com|nasa.gov)
  $DEFAULT

  :0 H
  * ^TO_notify(_at_)fridayfive(_dot_)org
  $DEFAULT


However, I would much prefer to maintain my whitelists as lists, in a
file
separate from .procmailrc

No need for those H-flags, H is the default and in some circumstances
harmful.

Maybe you can use this:

First, create a file $RCDIR/GREEN_DOMAINS.rc that looks like this:

  GREEN_DOMAINS="
tidbits.com
worldsmith.org
yahoogroups.com
nasa.gov
bbc.co.uk
"

Second, put these lines in your .procmailrc

  INCLUDERC=$RCDIR/GREEN_DOMAINS.rc
  :0
  * ^From [^(_at_)]@\/[^ ]+
  {
    From_Domain = $MATCH   # example: tv.bbc.co.uk

    :0   # try: co.uk
    * From_Domain ?? \/[^.]+\.[^.]+^^
    *$ GREEN_DOMAINS ?? $MATCH^
    $DEFAULT

    :0   # try: bbc.co.uk
    * From_Domain ?? \/[^.]+\.[^.]+\.[^.]+^^
    *$ GREEN_DOMAINS ?? $MATCH^
    $DEFAULT
  }


I want to use regexps in my greenlist.rc, so I use sed:
http://www.xs4all.nl/~rvtol/xs4all/ pm / greenlist.rc

  RegEx = \
  `sed \
  -e '/^[  ]*$/d; /^[  ]*#/d' \  (1)
  -e :a -e '$!N; s/\n/~/; ta' \  (2)
  -e 's/^/~/' \                  (3)
  -e 's/~#[^~]*/~/' \            (4)
  -e 's/~@/~[^(_at_)]+@/g' \          (5)
  -e 's/^~\{1,\}//; s/~\{1,\}$//; s/~\{1,\}/|/g' \
  $CFG_dir/greenlist.cfg`

This is messy, because I aimed for the unfolding as
being the last step.
(1) remove empty and comment-only lines
(2) unfold by replacing internal newlines by a tilde
(3) put a tilde at the start
(4) remove comment-lines (again) (oops, I think I forgot an ending 'g'
there)
(5) replace any start-@ with [^(_at_)]+@
(6) replace any (cluster of) tilde(s) by a vbar.

-- 
Affijn, Ruud


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>