#!/bin/sh
#    popsend: send command
#	$1 msg_file_dir
#	$2 signature file
crnt="`/bin/pwd`"
cd $1
IFS='
'
/bin/cat envelope > mail
/bin/echo ---------- >>mail
if [ -f $2 ] 
then
	/bin/cat letter $2 >> mail
else
	/bin/cat letter >> mail
fi
first="first"
for i in `ls *.ENC .*.ENC 2>&1`
do
	case $i in
        '*.ENC not found' | '.*.ENC not found')
			continue;;
	*)		case "$first" in 
			first) /bin/echo "{PopDesk Enclosure}" >> mail
			       first="not"
			esac
			/bin/cat $i >> mail ;;
	esac
done
/usr/new/mh/send $1/mail
/bin/rm -f $1/#mail
/bin/rm -f $1/_audio_msg.snd
cd $crnt
