Subject: How to reject mail from certain users

From: Frank J. Estremera <[email-masked]>
Date: Fri, 13 Jan 1995 17:25:01 -0500 (EST)

Forgive my newbie question but, I am trying to "cook up" a recipe to reject
e-mail from certain users, and return to them a canned message referencing
their subject, and the fact that I am not accepting mail from them. 

Thanx in advance for your help!

Frank

---

From: Rick Busdiecker <[email-masked]>
Date: Fri, 13 Jan 1995 19:43:59 -0500

From: "Frank J. Estremera" <[email-masked]>
    Date: Fri, 13 Jan 1995 17:25:01 -0500 (EST)

    
    Frank
    
I use this recipe:

 :0 w
 * ^From [email-masked]
 | /home/rfb/bin/auto_reject

I've enclosed my auto_reject at the end of this message.  It currently
stashes a copy of the message in a folder so that I can see if it's
ever actually used.

I'd recommend being very careful to ensure that the automatic message
is *not* sent in reply to mail that was redistributed through a
mailing list.  If you just want to `kill file' someone on a mailing
list, try something like this:

 :0
 * TO SomeMailingList
 * ^(sender|subject|from|to|cc):[email-masked]
 /dev/null

			Rick

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

#! /bin/sh
infile="/tmp/AR-$$.in"
outfile="/tmp/AR-$$.out"
cat > "${infile}"
from=`grep -i '^from: ' "${infile}" | head -1`
if [ "${from}" = '' ]
then
    echo "No From: field." > /dev/tty
    exit 1
fi
to=`echo "${from}" | sed -e 's/^From: *//'`
if [ "${to}" = '' ]
then
    echo "Empty From: field." > /dev/tty
    exit 1
fi
echo "To: ${to}" > "${outfile}"
echo "Subject: Automatically rejected mail" >> "${outfile}"
echo '' >> "${outfile}"
cat >> "${outfile}" << END_OF_FILE
The enclosed message has been automatically rejected by the receiver
as undesireable.

-----BEGIN AUTO-REJECTED MESSAGE-----

END_OF_FILE
cat "${infile}" >> "${outfile}"
echo '' >> "${outfile}"
echo '-----END AUTO-REJECTED MESSAGE-----' >> "${outfile}"
/bin/mail "${to}" < "${outfile}"
/home/technoids/mh-6.8/lib/rcvstore +plonk < "${outfile}"
rm "${infile}"
rm "${outfile}"

---

From: [email-masked] (David W. Tamkin)
Date: Sat, 14 Jan 1995 13:55:02 -0600 (CST)

Frank Estremera asked,

| Forgive my newbie question but, I am trying to "cook up" a recipe to reject
| e-mail from certain users, and return to them a canned message referencing
| their subject, and the fact that I am not accepting mail from them. 

It's fairly simple; the procedure depends on whether you want to return their
text to them or not.

First, take care of any mail from mailing lists: if one of the jerks submits
to a list you're on and you don't want to read that either, just save it to
/dev/null.  Do NOT autorespond because your reply might go to the list main-
tainer (whom you don't want to tell "Stop writing me, asshole!") or worse, to
the list's reflection address, from which it will be distributed to the en-
tire membership.  Then, later in your rcfile,

Notes: you can just keep their old subject (adding Re: if it isn't there
already) by leaving off the -i option to formail.  Normally, in the second
example, I'd use -I instead of -i and clobber the original subject, but you
said you want to reference it.  -i will leave it in an "Old-Subject:" header.

If I've misunderstood and you want to reference the subject *in* the returned
text (I don't see why because you don't want to hear from these people about
any matter at all), I'll come up with something else, but it will be more
complicated.

 # to return text
 :0
 * !^FROM_DAEMON
 * ^(Apparently-)?(Resent-)?(From|Reply-To).*(jerk1|jerk2|jerk3|...)
 {
   :0fw # no `h' flag, -k option to formail
   | formail -rk -i"Subject: Shut up and go away!"

   :0bfw
   | echo \
   "I told you never to write to me again.  Your letter was deleted unread." \
   ; echo ; cat -

   :0
   ! -oi -t
 }

 # without returning text
 :0
 * !^FROM_DAEMON
 * ^(Apparently-)?(Resent-)?(From|Reply-To).*(jerk1|jerk2|jerk3|...)
 {
   :0hfw # with `h' flag, no -k option for formail
   | formail -r -i"Subject: Shut up and go away!"

   :0bfwi
   | echo \
   "I told you never to write to me again.  Your letter was deleted unread."

   :0
   ! -oi -t
 }

David W. Tamkin  Box 3284  Skokie, Illinois  60076-6284
[email-masked]    MCI Mail: 426-1818   +1 312 714 5610

---

From: "J. Daniel Smith" <[email-masked]>
Date: Sat, 14 Jan 95 15:27:22 -0500

Rick Busdiecker ([email-masked]) writes on 13 January 1995 at 19:43:59 -0500
>[...]
>[...]
Here's what I use to avoid sending out automatic "mail received"
messages.

#####
##### an automatic reply back to people I don't correspond with on a
##### regular basis...I get too much mail
#####    - skip program mailers
#####    - skip low priority mail
#####    - prevent loops 
#####    - In-Reply-To/References: in case someone replies to
#####      something I posted to a mailing list (add Newsgroups:?)
#####    - skip local addresses
#####    - skip mailing lists I maintain
#####
VACA_SUBJECT="^Subject: .*(\[(ack(nowledge?ment)?|on vacation)\]|\
auto(matic)[- ]reply|away from mail|out of town|can ?not (reply|answer)|\
(on |via )vacation( program)?)"
:0
* !^FROM_DAEMON
* !^Precedence: ?(bulk|list|junk)
* $!^X-Loop: ${UNIQUE_NAME}
* !^(In-Reply-To|References):
* $!${VACA_SUBJECT}
* $!^From:.*@.*${FQDN}
* $!^TO(owner-.*|.*-request)@${FQDN}
...some action...

>[...]
>[...]
You might want to replace this with "formail -rt", among other things,
this will use a "Reply-To:" header, if available.  formail's use is not
restricted to use solely within a ~/.procmailrc file.

   Dan
---------------------- message is author's opinion only ----------------------
J. Daniel Smith         Bristol Technology Inc., Ridgefield, Connecticut (USA)
[email-masked]         (203) 438-6969, 438-5013 (FAX) {info,[email-masked]
                        FTP: ftp.bristol.com       WWW: http://www.bristol.com
                                --------
 Von guten Maechten wunderbar geboren, erwarten wir getrost, was kommen mag.
 Gott ist mit uns am Abend und am Morgen, und ganz gewiss an jedem neuen Tag.
	- Dietrich Bonhoeffer