jchvr@ihlpg.UUCP (VanRietschote) (04/29/86)
-- man page for MAILAWWY.C # -- cut here -- .TH MAILAWAY 1 "HFVR" .SH NAME .\" name \- one-line description for in permuted index mailaway \- Unix mail answering service .SH SYNOPSIS .\" bnf on command syntax mailaway [-d] [-V] [-H] [-x pgrm] [-f file] [-o options] .SH DESCRIPTION .\" semantics Mailaway will determine for each electronic message waiting for you, the following facts: .nf .sp SUBJECT, the subject of this message (if any) (leading spaces stripped) SENDER, the login name of the sender NROFLINES, the length of the message in lines SIZE, the size of the message in characters VIA, the full path (including SENDER) used to send this message MESSAGE, the name of the file containing a copy of the message DEMON, either TRUE or FALSE if sender is a known demon LAST, either TRUE or FALSE if this was last message or not .sp .fi These facts are stored into shell variables of the same name. After doing so this information is passed on to the excutor (default: /bin/sh) for execution. After the executor stops the message is deleted. .SH OPTIONS .in +5 .ti -5 .tr ~ -f~~~Takes as argument the name of a file which will also be passed to the executor. (Default is $HOME/.mailawayrc). .sp .ti -5 -x~~~Takes as argument the name of an alternative for the executor. (default is /bin/sh). .sp .ti -5 -o~~~Takes one argument which will be passed to the executor as command line option. Default is empty. .SH EXAMPLES To append all your messages to a file $HOME/x you can use: .nf mailaway -f append Where append is a shell script containing the line: cat $MESSAGE >> $HOME/x .fi .sp To append messages to files depending on the sender of the message use: .nf mailaway -f append2 Where append2 is a shell script containing the line: cat $MESSAGE >> $HOME/mail/$SENDER .fi .bp To automatically answer your mail while away: .nf mailaway -f answerit Where answerit could contains the lines: .sp if test "$DEMON" = "TRUE" then exit # ignore them fi # reply to sender /bin/mail $VIA <<!! Subject: Auto answering service Dear $SENDER, I am away right now but received your message at `date` I will anwer it as soon as a return on 1 April. !! cat $MESSAGE >> $HOME/mail/.stack_of_mail # save it if test "$SENDER" = "myboss" # see if needs forwarding then TMP=/usr/tmp/$$ cat > $TMP <<!! Dear representative, Could you treat the following message? bvd, $LOGIN !! cat $MESSAGE >> $TMP /bin/mail represt < $TMP rm -f $TMP fi .fi .bp The following script can be used for those logins that are yours to maintain but usually you do not login there. However you do want mail forwarded to you that looks like it is personal. .nf mailaway -f getpersonal Where getpersonal contains: .sp if test "$DEMON" = "TRUE" then exit # just ignore these fi # save all mail that are used as updates (have 'update' in # subject) echo $SUBJECT | grep -i 'update' >/dev/null 2>&1 if test "$?" = "0" then cat $MESSAGE >> $HOME/todo/updates fi # forward all other stuff /bin/mail yourlogin < $MESSAGE .fi .SH FILES /usr/mail/$LOGIN (or $MAIL) .br $HOME/.mailawayrc .SH BE AWARE Be aware that if you use crontab to execute mailaway, the output is send as mail, it is therefor best to redirect stdout and sterr to some log file as follows: .nf mailaway ..... >$HOME/log 2>&1 .fi .SH SEE ALSO mail(1), answer(1), crontab(1)