🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: tek.software
Article #1

friendly interface to MH mail commands

#1
From: Michael Prusynski
Date: Wed, 19 Jan 1994 23:21
73 lines
3417 bytes
I've been using this for years, and should have shared it long ago...

I have a program called "m" that serves as a front-end to the MH mail commands.
"m" is a short shell-script program to read, remove, re-pack mail with just
a few keystrokes, and without having to remember the respective MH commands.
"m" provides help for the other MH commands when you type: h
and allows you to type these commands and any Unix command from its prompt.
It scans your mail and pipes it thru "more" if you have more than 24 messages.
After you read a mail message, it asks if you want to remove it, and it
renumbers your mail messages after you remove one.
It also provides a "prm" command that strips the mail header garbage off
before printing the mail.

I now have the fancy X-windows Xmh, but its easier & faster to use "m".
Here it is...
----------------------------- cut here ---------------------------------
: 
# friendly interface to MH mail programs
inc
CLEAR=`clear`
cd $HOME/Mail/inbox
SCAN=`ls [0-9]* | wc -l`
if test $SCAN -gt 23 ; then	# page thru message list if more than 23 msgs
    SCAN="scan | more"
else
    SCAN=scan
fi
while :; do
    echo $CLEAR'   #  DATE  FROM			SUBJECT'
    eval $SCAN
    echo -n 'Type a number, h for help, q to quit, or a mail command: '
    read command
    case $command in
        q*) exit 0 ;;
    [1-9]*) command="show $command" ;;
    " "|"") command=show ;;
      prm*) set $command
	    echo "printing mail $2..."
	    command="show $2 | sed -e '/^Return-Path:/d' -e '/^Received:/d' \
		-e '/^	id/d' -e '/^Message-Id/d' -e 's/^/  /' | lpr" ;;
        h*) echo '
To show a mail message on the screen, type its number and press RETURN.
Just pressing RETURN shows the mail message marked with  +
Just pressing RETURN when you see "remove?" defaults to a "no" answer.
The list is automatically renumbered after you remove mail.

-- Example Mail Commands -- no number defaults to the message marked with  +
rmm 1		remove mail message 1 (or whatever number you type, else  + )
prm 1		print  mail message 1 (or whatever number you type, else  + )
comp		compose a message. When you exit & see "what now?" you can type:
		  send		to send the message, or
		  edit		to re-edit the message before sending it, or
		  quit		save message in Mail/draft without sending
repl 1		reply to message 1. Same as comp, but fills in the "To:" line
forw 1		forward  message 1. You must fill in the "To:" line
show, prev, next are self-explanatory.  It is shorter to just type the number.
'
	    command=: ;;	# after help msg, give "do nothing" to eval 
    esac
    eval "$command"
    case $command in
	show*|p*|next)
	    echo -n 'remove this mail? (y/n) '
	    read command
	    case $command in
		y*|Y*) rmm ; folder -pack ;;
		q*) exit 0 ;;
	    esac ;;
	rmm*) folder -pack ;;
	 *) echo -n 'press RETURN to continue: '
	    read command ;;
    esac
done
Technical Details
Message-ID: <13322@tekig7.PEN.TEK.COM>
Path: arc1-ca.pugleaf.net!wupost!udel!gatech!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!news.tek.com!tekig7!tcsegp1!michaelp

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!wupost!udel!gatech!howland.reston.ans.net!europa.eng.gtefsd.com!uunet!news.tek.com!tekig7!tcsegp1!michaelp
From: michaelp@tcsegp1.PEN.TEK.COM (Michael Prusynski)
Newsgroups: tek.software,tek.sources,tek.unix,alt.sources,comp.unix.shell
Subject: friendly interface to MH mail commands
Keywords: MH-mail, shell-script, Unix
Message-ID: <13322@tekig7.PEN.TEK.COM>
Date: 19 Jan 94 23:21:27 GMT
Sender: news@tekig7.PEN.TEK.COM
Followup-To: poster
Lines: 73