procmail
[Top] [All Lists]

Re: Mail List Filter (MLF?)

2000-03-29 17:39:59
Anthony Thyssen said:

<>   1/ Someone must have implemented just a bare minimum mail list filter.
<>      But I can't seem to locate an example of it.
<> 
<>   2/ How can procmail resubmit a mail to a large list of addresses?
<> 
<>      Majordomo does this by creating a   testlist-outgoing
<>      mail alias and re-sending the mail to that, but that outgoing list
<>      has now spam filter protection, if you know majordomo is being
<>      used.
<> 
<>      I am investigating SmarList at this time to find its solution
<> 
<>   3/ How should procmail handle rejected mail, assuming it isn't of
<>      course ^FROM_DAEMON.  I have read the ``Moronic Mail Autoresponders
<>      (A FAQ From Hell)'' webpage but that doesn't give a example of
<>      using procmail to bounce mail.   
<>      
<>   4/ Any suggestions on determining if a mail originates from outside a
<>      particular domain or IP pattern.    This does not seem trival
<>      as finding the last sendmail Recived: header for the host procmail
<>      is running, as this mailing list message could have been forwarded
<>      to this machine from another inside the domain.
<> 
<>      EG:   spmmaer.outside_domain -> machine.domain
<>      Then  machine.domain  -> maillist_server.domain
<>      which explodes the mail. 

Hmmm ... I'd probably do it like this:

in /etc/aliases:

  testlist:     "|/usr/bin/procmail -m LIST=testlist /<path to script>/filter.rc
  testlist-out: :include:/<path to lists>/address-file
  owner-testlist:       <some bloke>@<your domain>

in "/<path to rc scripts>/filter.rc"

  FROM=`formail -rzxTo:`

  :0
  * ! ? fgrep -xqs "$FROM" /<path to lists>/$LIST
  {
    # Address didn't match a subscriber to the list

    # Rewrite message to forward it to the list own er (Course prof?)
    :0 f
    * ^Subject:\/.*
    | formail -i"Subject: REJECTED MAIL for $LIST: $MATCH"
              -i"To: owner-${LIST}@<your domain>

    :0
    | $SENDMAIL -oi -t
  }

  # Otherwise, this message is from someone in the address list
  # Forward it out to the real :include: list
  :0
  ! testlist-out

You can no doubt improve on this with a bit of thought. The key to this
script is using the subscriber list to filter the mail, whcih means we
know who to "filter IN", and exclude anyone else, whcih is much easier than
trying to filter out bad guys.

(All of the elements were taken from recipes that work, and glued
together -- the results have not been tested.  Test rigorously ...)

Rgds,

RL
-- 
R A Lichtensteiger       rali(_at_)tifosi(_dot_)com -or- 
rali(_at_)world(_dot_)std(_dot_)com

        Holy St. Isador, preserve us from the evil of Gates!

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