[comp.mail.mh] Aliases and MhMail

jhon@dubhe.gsfc.nasa.gov (Honce. Jhon) (12/19/90)

How can I use aliases with mhmail?

The only way I've found is:
	mhmail `ali -normalize alias` <file

I want:
	mhmail alias <file

I'm not sure if the problem is in MhMail or Post, or in my
installation.  Any ideas on where to look would be great.

version: MH 6.7.1 #9[UCI] (dubhe) of Mon Dec 17 15:57:52 EST 1990
options: [BSD42] [BSD43] [SUN40] [TYPESIG=void] [BIND] [DUMB] [RPATHS]
         [MHE] [SBACKUP='"#"'] [MSGPROT='"0600"'] [SENDMTS] [SMTP]

-- jhon honce

jhon@dubhe.gsfc.nasa.gov

-- jhon honce

jhon@dubhe.gsfc.nasa.gov

jromine@buckaroo.ics.uci.edu (John Romine) (12/19/90)

jhon@dubhe.gsfc.nasa.gov (Honce. Jhon) writes:
>
>[I use]:
>	mhmail `ali -normalize alias` <file
>I want:
>	mhmail alias <file

You can't do that.  "mhmail" doesn't read your .mh_profile, so it
doesn't know where to look for alias files.  Don't ask me to make
it read the profile; mhmail is intended as a replacement for /bin/mail,
and not all users may have an MH profile.

Backquoting "ali" is the right solution, if you want to do this.
--
John Romine

jch@chumley.tn.cornell.edu (Jeffrey C Honig) (12/20/90)

> How can I use aliases with mhmail?

> The only way I've found is:
>	mhmail `ali -normalize alias` <file

The problem with your method is that mhmail will choke on aliases that
contain personal names, for example:

	jeff:	Jeffrey C Honig <jch@devvax.tn.cornell.edu>

To do this with one alias you could use:

	mhmail "`ali -normalize alias`" < file

It is more difficult to do with several aliases.  I wrote the
following script to send a piece of test mail for debugging mailers
that you could probably easily modify to do what you want.

Jeff

#! /bin/sh

if [ $# -lt 1 ]; then
	echo "Usage: ${0} address [address] [address] ..."
	exit 1
fi

line= ;
send=1 ;

for name do
	case ${name} in
		-cc|-from)
			line="${line} ${name}" ;
		;;
		-test)
			send=0 ;
			;;
		-*)
			echo "Invalid switch" ${name} ;
			exit 1 ;
		;;
		*)
			line="${line} `/usr/local/lib/mh/ap -format '%<{error}%{error}: %{text}%|%(putstr(mbox{text}))%<(nohost{text})%|%(lit @)%(putstr(host{text}))%>%>' \"\`ali ${name}\`\"`" ;
	esac
done

if [ $send -eq 1 ]; then
	mhmail ${line} -subject "Test.`hostname`.$$" -body "Please ignore this test mail."
else
	echo ${line} ;
fi

andyc@bucky.intel.com (Andy Crump) (12/26/90)

>>>>> On 18 Dec 90 23:58:17 GMT, jhon@dubhe.gsfc.nasa.gov (Honce. Jhon) said:


Honce.> How can I use aliases with mhmail?

Honce.> The only way I've found is:
Honce.> 	mhmail `ali -normalize alias` <file

Honce.> I want:
Honce.> 	mhmail alias <file

Honce.> I'm not sure if the problem is in MhMail or Post, or in my
Honce.> installation.  Any ideas on where to look would be great.


In mh-6.7/miscellany/scripts is a script to do just this, it is called
amhmail.sh.  Check it out.
--

    -- Andy Crump

    ...!tektronix!reed!littlei!andyc | andyc@littlei.intel.com
    ...!uunet!littlei!andyc          | andyc@littlei.uu.net

Disclaimer: Any opinions expressed here are my own and 
            not representive of Intel Corportation.