3 # amhmail - aliased version of mhmail(1)
5 # This program has the same syntax as does mhmail(1). The differences
6 # are that amhmail will do aliasing of addresses by using ali(1) which
7 # mhmail(1) does not do.
9 # The other difference is that amhmail will prompt you if the body of
10 # the message is not specified on the command line and stdin is a
13 # WARNING: DON'T CALL THIS FILE 'mhmail' or 'ali'!
15 # Andy Crump (andyc@inteloc)
16 # phone: 681-4697, MS: JF1-70
20 USAGE="syntax: $PGM [addrs ... [-body text] [-cc addrs ...] [-from addr] [-s su
23 if [ $# -eq 0 ]; then # If no arguments, do an inc(1)
37 -help) # Help message only
41 -b*) # -body option, next argument is the text
48 -s*) # -subject option, next argument is the text
55 -c*) # -cc option, all non (-) arguments are taken
59 while [ $BREAK -eq 0 ]
80 -f*) # -from option, next argument is the text
88 echo "$PGM : $1 unknown option."
92 *) # the addresses or garbage
93 if [ ! -z "$ADDRS" ]; then # if we already have the
94 # addresses, this must be
101 while [ $BREAK -eq 0 ]
111 if [ $# -ne 0 ]; then
126 # Build the command line
129 CMDLINE="mhmail $ADDRS"
131 if [ "$BODY" != "NO BODY" ]; then
132 CMDLINE="$CMDLINE -b \"$BODY\""
134 if [ -t 0 ]; then # if stdin is a terminal
135 echo "$PGM : Body of message is being read from stdin."
136 echo " Please enter your message and then type ctrl-D."
140 if [ ! -z "$CC" ]; then
141 CMDLINE="$CMDLINE -cc $CC"
143 if [ ! -z "$FROM" ]; then
144 CMDLINE="$CMDLINE -from $FROM"
146 if [ ! -z "$SUBJECT" ]; then
147 CMDLINE="$CMDLINE -subject \"$SUBJECT\""
150 eval "$CMDLINE" # do it!