[comp.mail.misc] Filtering junk mail

chip@ateng.ateng.com (Chip Salzenberg) (12/03/88)

[ Followups to comp.mail.misc ]

According to kuro%shochu@Sun.COM (Teruhiko Kurosaka):
>Does anyone out there knows any way to insert a filter program
>in the sendmail daemon so that a piece of e-mail that meets
>a certain criteria (such as addressed to an alias but not addressed
>to the user directly) goes to a designated folder automatically, or
>just be thrown away?

This is a common desire, thus the followup here instead of E-Mail.

My "deliver" program, recently posted to comp.sources.unix and currently at
patch level 6, should satisfy your needs quite nicely.

You could use your .forward file to hand all your mail to "deliver":

	"|/usr/bin/deliver kuro"

Then your could write a delivery file that puts each message in a mailbox
that depends on the contents of the "To:" line.  An example:

	# /usr/kuro/.deliver
	# Separate mail into mailboxes, depending on the "To:" address.
	# Note that multi-line "To:" addresses aren't handled yet.

	user="$1"
	to="`sed -n 's/^To: //p' $HEADER`"

	case "$to" in
	*junk-alias*)   ;; # Throw it away!
	*foo-alias*)    echo "$user":foo-mailbox ;;
	*bar-alias*)    echo "$user":bar-mailbox ;;
	*)              echo "$user":normal-mailbox ;;
	esac

This is just an example.  You can get as fancy as you like.

If you didn't pick up deliver, check with your site admin; and if he can't
help you, write me back and I'll see what I can do.
-- 
Chip Salzenberg             <chip@ateng.com> or <uunet!ateng!chip>
A T Engineering             Me?  Speak for my company?  Surely you jest!
	   Beware of programmers carrying screwdrivers.

msir_ltd@uhura.cc.rochester.edu (Mark Sirota) (12/04/88)

In article <79561@sun.uucp> kuro@sun.UUCP (Teruhiko Kurosaka) writes:
> Does anyone out there knows any way to insert a filter program
> in the sendmail daemon so that a piece of e-mail that meets
> a certain criteria (such as addressed to an alias but not addressed
> to the user directly) goes to a designated folder automatically, or
> just be thrown away?

This does not belong in sendmail, since it is something particular to a
single user.  (I have redirected followups to comp.mail.misc).

The mail program "mush" (Mail Users' SHell), available from
comp.sources.unix, will do this for you.
-- 
Mark Sirota
 msir_ltd@uhura.cc.rochester.edu (rochester!ur-cc!msir_ltd)

pat@orac.pgh.pa.us (Pat Barron) (12/05/88)

You can also do this with the "slocal" program that comes with the MH
distribution.  You filter your mail through it in your .forward file,
and it reads a configuration file called ".maildelivery" from your
home directory with instructions on what to do with various pieces
of mail.

--Pat.
-- 
Pat Barron
Internet:  pat@orac.pgh.pa.us  - or -   orac!pat@gateway.sei.cmu.edu
UUCP:  ...!uunet!apexepa!sei!orac!pat  - or -  ...!pitt!darth!orac!pat

pae@cos.com (Paul A. Ebersman) (12/05/88)

From article <442@ur-cc.UUCP>, by msir_ltd@uhura.cc.rochester.edu (Mark Sirota):
 In article <79561@sun.uucp> kuro@sun.UUCP (Teruhiko Kurosaka) writes
> Does anyone out there knows any way to insert a filter program
> in the sendmail daemon so that a piece of e-mail that meets
> a certain criteria (such as addressed to an alias but not addressed
> to the user directly) goes to a designated folder automatically, or
> just be thrown away?


The Elm mail program (currently v2.1 patch level 1) includes a program
called "filter" which you put in your .forward file. Filter uses a rule
set that you make to filter your mail. It has string matching on To:,
From:, and Subject fields and can also key on # of lines. I couldn't
handle the amount of mail I get easily without this.

---
               Paul A. Ebersman @ Corporation for Open Systems
  pae@cos.COM or pae%cos.com@uunet.uu.net or {uunet, sundc, hadron}!cos!pae
     ( The difference between practice and theory in practice is always
      greater than the difference between practice and theory in theory. )
-- 
               Paul A. Ebersman @ Corporation for Open Systems
  pae@cos.COM or pae%cos.com@uunet.uu.net or {uunet, sundc, hadron}!cos!pae
     ( The difference between practice and theory in practice is always
      greater than the difference between practice and theory in theory. )

wyle@solaris.UUCP (Mitchell Wyle) (12/16/88)

I've been running a scheme similar to elm's filter program for
a few years which does what you want.  It's a bunch of shell 
scripts and a "rule-base" of pattern-action rules.  Incoming
mail is .forwarded through the "inference" engine at delivery
time.

I have an un-published paper about it; the abstract:

A rule based system performing user-specific pre-defined actions on
electronic mail messages is presented.  The system screens, forwards,
saves, and processes certain in-coming messages when they arrive at a
user's mailbox.  The mail filter model, algorithm and implementation
are presented with examples illustrating its utility.

E-mail me if you want more info.
-- 
-Mitchell F. Wyle                         wyle@ethz.uucp
Institut fuer Informatik                  wyle@inf.ethz.ch
ETH Zentrum / 8092 Zurich, Switzerland    +41 1 256 5237