#!/bin/sh # # fake-sendmail -- pretend to be the sendmail program # # Pretend to be the sendmail program and collect the out going mail. # Which is passed to the filter script "outmail" to edit (append # signature) as the user desires. # # To use and the wrapper script "fake-sendmail" to your ".mailrc" file # with the line. # set sendmail=/path/to/fake-sendmail # Or if these scripts are on your command PATH # set sendmail=fake-sendmail # # Anthony Thyssen # # Discover where the shell script resides ORIGDIR=`pwd` # original directory (builtin) PROGNAME=`type $0 | awk '{print $3}'` # search for executable on path PROGDIR=`dirname $PROGNAME` # extract directory of program PROGNAME=`basename $PROGNAME` # base name of program cd $PROGDIR # go to that directory PROGDIR=`pwd` # remove any symbolic link parts # --- Read Arguments and Mail --- sendmail="/usr/lib/sendmail" # the real sendmail program mailfilter="$PROGDIR/mailout" # location of mail filter VERBOSE= # Check for the sendmail verbose flag for i in "$@"; do case $i in -[qd]) NO_FILTER=true sendmail_args="$sendmail_args $i" ;; -v) echo >&2 "Fake Sendmail -- Wrapper for outmail Script" sendmail_args="$sendmail_args $i" VERBOSE=true ;; *) sendmail_args="$sendmail_args $i" ;; esac done if [ "$VERBOSE" ]; then echo >&2 "Filtering Mail to real sendmail program" echo >&2 " $mailfilter -v | $sendmail $sendmail_args" fi if [ "$NO_FILTER" ]; then $sendmail $sendmail_args else $mailfilter -v | $sendmail $sendmail_args fi # ------------