[comp.mail.elm] autoreplying to mail with "filter"

taylor@hpdstma.hp.com (Dave Taylor) (07/28/88)

Here's a fun Elm-related project that someone out there might
want to play around with ... the person to whose message I am
replying asked about the 'autoreply' program that was distributed
as a part of the Elm Mail System package...

Dave Taylor

--------- attachment:

Actually, you'll find that autoreply isn't `supported' any more 
and that a better way to do it is to hack something into the
filter ruleset like:

	always execute "reply-script %r '%S'"

(in your ~/filter-rules file), an entry like:

	\taylor,"|filter"

in your ~/.forward file, and then have the reply-script be something 
like:

	: Use /bin/sh

   	# reply-script -- used for autoreplying to mail received
	# in conjunction with the Elm Filter Program.
	# 
	# Usage: reply-script <return address> <Re: subject>

	 addrs_sent_to="/users/taylor/.replied-to"
	autoreply_file="/users/taylor/.reply-msg"

	if [ "`grep -i $1 $addrs_sent_to`" == "" ]; then
	  # autoreply
	  elm -s "$2" $1 < $autoreply_file
	  echo $1 >> $addrs_sent_to
	fi

	exit 0

Notice that if you're gone for a year, say, it'll only ever send one
copy of your reply to the person sending the mail.  TO refine the 
script to deal with that, you could have a directory called, say,
".replied-to" with each file being a MMDDYY timestamp.  The script
would grep through *all* of them for an entry before sending off a
reply, and at the end could perhaps spawn off a find like:

	find ~/.replied-to -ctime 14 -exec /bin/rm {}\;

which will give you a 14 day backlog at any given time...

[It would also be nice to offer 'n' different sets of replies
 that could be used, based on, say, if the user is in your
 alias file, or in some other 'friends' database ... again, it
 would be easy to add this...]

						-- Dave Taylor