[comp.mail.sendmail] Filtering junk mail

kuro%shochu@Sun.COM (Teruhiko Kurosaka) (12/01/88)

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?
I am receiving a lot of junk e-mails through an alias that I am
forced to be a member of.  I am interested in have sendmail automatically
sort out these pices of junk e-mail.
I have a feeling that the same trick "vacation" program uses can be
used for this purpose and am wondering if anybody has already experienced
this.
Please address your reply directly to kuro@sun.com because I don't
check this news group so frequently.
Thank you in advance.

T. Kurosaka (kuro@sun.com)

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

andrew@cc.brunel.ac.uk (Andrew Findlay) (12/05/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?

Look at the 'filter' program that comes with the Elm mailer.
To use it, you just set up your .forward file to pipe all mail through
the filter and it applies a set of rules to each item of mail.

The rules can specify that different things happen to the mail depending on
who it was addressed to, and a number of other things.

Andrew

-- 

---------------------------------------------------------------------
|  From Andrew Findlay at Brunel University, Uxbridge, UB8 3PH, UK  |
|  Andrew.Findlay@brunel.ac.uk          phone: +44 895 74000 x2512  |
---------------------------------------------------------------------