Xref: utzoo comp.mail.sendmail:303 comp.mail.misc:1444
Path: utzoo!utgpu!watmath!clyde!att!rutgers!apple!bionet!agate!labrea!decwrl!sun!pitstop!sundc!seismo!uunet!ateng!chip
From: chip@ateng.ateng.com (Chip Salzenberg)
Newsgroups: comp.mail.sendmail,comp.mail.misc
Subject: Re: Filtering junk mail
Message-ID: <1988Dec2.154739.3368@ateng.ateng.com>
Date: 2 Dec 88 20:47:38 GMT
References: <79561@sun.uucp>
Reply-To: comp.mail.misc
Organization: A T Engineering, Tampa, FL
Lines: 43

[ 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              or 
A T Engineering             Me?  Speak for my company?  Surely you jest!
	   Beware of programmers carrying screwdrivers.