home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- #
- # AUTHOR: Timothy J. Luoma <luomat@peak.org>
- #
- # VERSION: 1.1.0
- #
- # DATE: 6 March 1997
- #
- # WARNING: USE ENTIRELY AT YOUR OWN RISK
- #
- # PURPOSE: To use as a Mail.app mailer as a safety-net against
- # accidentally 'sending' a message
- #
- # TESTED UNDER: NeXTStep 3.2 and 3.3 on my NeXTStation
- #
- # USAGE NOTES: chmod 755 stopthatmail && mv stopthatmail /usr/local/bin
- # Set your Mail.app mailer (Expert preferences) to
- # /usr/local/bin/stopthatmail or wherever you put it.
- #
- # NOTE: This may not work with any other version of Mail.app than 3.3
- #
- # REQUIRES: the "Alert" binary from the "Shell Panels" package
- # (ShellPanel.2.0.NIHS.bs.tar.gz) which can be found at
- # ftp://ftp.next.peak.org/pub/next/apps/utils/unix/
- #
- # KNOWN BUGS:
- # 1) the "Return to me" does not work with the Mail.app in 3.2
- # 2) addresses must have an "@" in them
- #
- #
- # HISTORY:
- # 1.1 - fixed munging of multiple addresses in version 1.0
- # 1.0 - released for 45 minutes (see bugfix listed for 1.1)
- #
-
- name=`basename $0`
-
- SUBJECT=`cat - | grep "^Subject:" `
-
- # this is to strip everything except the actual address
- #
- ADDRESSES=`echo $*| tr -s ' ' '\012' | grep "@" | tr -s '\012' ' ' `
-
- Alert -t "$SUBJECT" \
- "Deliver message to $ADDRESSES ?" \
- "Yes" "No" "Return to me"
-
- exitcode="$?"
-
-
- case $exitcode in
- 0) /usr/lib/sendmail -oi -odb $ADDRESSES &&
- echo "$name: sent /usr/lib/sendmail -oi -odb $ADDRESSES" \
- >/dev/console && exit 0
-
- echo "$name[$$]: something went wrong, message not sent" \
- >/dev/console
- ;;
-
-
- 1) echo "$name[$$]: cancelling message to $ADDRESSES" \
- >/dev/console
- exit 0
-
- ;;
-
- *) echo "$name[$$]: Returning message to `whoami`">/dev/console
- kill -9 $$
-
- ;;
- esac
-
- #echo "$name[$$]: exited with code $exitcode" >/dev/console
-
- exit 0
- #end
-