[net.sources] The Msg Mail System - documentation

dat@hpcnof.UUCP (01/17/86)

Speaking of mail systems...

	Herein is attached the users guide to the Msg mail system.  The
system currently runs on Bell system *, HP-UX and Amdahl UTS, and is on
the verge of working on a BSD system.

	For further information, please contact me at

					ihnp4!hpfcla!d_taylor

				or:     hpcnof!d_taylor@HPLABS

---- attachment:

'
'  Users guide to the MSG mail system.
'  format with 'nroff -mm Msg.guide > Msg.format
'  or something similar.
'  (C) 1986 Dave Taylor
'
'  reachable at ..ihnp4!hpfcla!d_taylor
'  or HP - CNO, 3404 E. Harmony Rd, Fort Collins, CO, 80525
'
'  (303) 229-2419
'
'  Last update to this document: January 14th, 1986
'
.SA 1
.nr Hy 1
.nr Pt 1
.PH ""
.PF "''Page \\\\nP'"
.HM 1 1
.sp 3
.PH "'Msg Users Guide''Version 3.0'"
.ce 99
Msg 3.0 Users Guide
.sp 2
Dave Taylor
.sp 2
\*(DT
.ce 0
.sp 3
.H 1 "Introduction"
.P 1
The UNIX operating system was originally written on a small PDP machine
to work with teletypewriters.  Consequently, all the original software for
the operating system was written with a 'tty' in mind - they were all 
line oriented, rather than screen oriented.
.P
Gradually this began to change, and, with the addition of the Berkeley
.I vi
visual shell to the 
.I ed
line editor, the trend was brought to the attention of certain 
UNIX systems designers.  
.P
This, however, seemingly hasn't been enough, as 
.I vi
and
.I notes
are still the only screen oriented software available
(other than games, which are a taboo subject with managers
and the like!).  Consequently, after becoming more and more frustrated
with the existing electronic mail facilities on the system ('mail'
and 'mailx', both of which are essentially line-editors) I decided
to write my own!
.P
This document discusses the 
.I msg
mailer, and includes a set of example screens and a discussion
of configuration (for systems administrators).  It is broken
down into the following general sections;
The \fI.msgrc\fR file,
starting options of 
.I msg,
the main system level,
responses of various commands,
the alias system,
and system configuration.
.P
Any comments or problems with either this document or the program
itself are welcome: all installed systems should have an alias
that will ensure that I receive any mail sent to 'msg'.
.SK
.H 1 "The .msgrc File"
.P
The \fImsg\fR mailer has the 
ability to automatically read in a configuration 
file at each invocation.  The file must be
called ".msgrc" and reside in your home directory for it
to be read in, and can have any of the following entries
in any order (note that the first four entries replace
environment variables of the same name, and the four
boolean options supplement required starting parameters);
.VL 10 0
.LI  "maildir"
This is the default mail folder.  It is used to expand filenames
in the mailer when specified using the '=' metacharacter.  That
is, if you save to file "=/stuff" then the '=' will be expanded
to the current value of maildir.
.LI "mailbox"
This is where to put incoming mail after you've read it.
When you answer 'y' to the "save to mailbox?" prompt, this
is where the messages go!
.LI "editor"
The editor to use when typing in message to people.
.LI "print"
This indicates how to print out a message.  There are two
possible formats for this string, either a command that
can have a filename affixed to (as a suffix) and then
sent to the system for execution, or a string that 
contains the meta-sequence '%s' which will be replaced
by the name of the file and then also sent to the
shell.  Examples of each are;
.nf

	print = print -formfeed
	print = pr %s | lpr

.fi
.LI "prefix"
When you reply to a message or forward a message to another person,
you can optionally include the original message.  Defining the
prefix value here allows you to indicate what the prefix of 
each included line should be.  The default is "> " and is
fairly standard in the Unix community.
.LI "savemail"
This is where outgoing mail will have a copy silently (and
quickly) saved.  This will only be used if the flag 'copy'
is turned on.  Also note that if the 'savename' flag
is turned on then this line is ignored since each outgoing
message is saved according to whom it's being sent to.
.LI "shell"
This defines the shell to use when doing '!' escapes and
such.  Note that the program also reads the $SHELL variable
out of the current environment, but that defining this
in the .msgrc file will override the environment definition.
.LI "weedout"
This is something new and exciting!  When specifying this
option, you can then list as many headers of messages that
you \fBdon't\fR want to see when you are read mail.
This list can continue for as many lines as desired, as 
long as the continued lines all have leading indentation.
.LI "autocopy"
This is a boolean flag, and if set will automatically copy
the text of each message being replied to into the edit
buffer.  This is the same as the '-a' starting parameter.
.LI "copy"
This, in combination with the "savemail" filename, will
allow you to have silent copies of all outgoing mail
made on the outbound step.  
.LI "resolve"
This is a boolean flag that defines the behaviour of the
program for such actions as deletion, saving a message 
and so on.  This is the same as the '-r' starting
parameter.
.LI "weed"
This is a boolean flag that, in combination with the
"weedout" list, allows you to custom define the set of
headers you would like to not have displayed while reading
messages.  The defaults are listed further into the
document.
.LI "noheader"
This boolean flag tells the mailer not to include the 
headers of messages when copying a message into a file
buffer for replying to or forwarding.
.LI "titles"
This boolean flag allows you to have each page of a message
to be titled with:
.nf
Message #N from username	Mailed date at time
.fi
where all the information has been previously extracted
from the message.
This is especially useful if you weed out all the headers of each
message with a large 'weedout' list...
.LE
.sp
Two more things: the format for each of the lines is;
.nf

	variable = value

.fi
and for boolean variables, value can be 'ON' or 'OFF' only.
.sp
For a better idea of how this all works, here's my .msgrc file.
While looking through it, notice that you can have lots of comments
and blank lines for readability and that you can also use 'shell
variables' and the '~' metacharacter for your home directory, 
and they are expanded accordingly when read in by the mailer.
.nf

  #
  # .msgrc - automatic variable defines for the 'msg' mailer.
  #
  # Personalized for Dave Taylor
  # 
  
  # where to save my mail to, default directory
  maildir  = ~/Mail
  
  # where to save messages to, default file
  mailbox  = ~/Mail/mailbox
  
  # what editor to use
  editor   = $EDITOR
  
  # where to save mail if not specified somewhere else
  savemail = ~/Mail/mail.sent
  
  # how to print a message ('%s' is the filename)
  print    = /usr/local/bin/print -p lpn -f %s
  
  # prefix sequence for including message text in other messages...
  prefix = > 
  
  # what headers I DON'T want to see, ever.
  
  weedout  = "Via:"  "Sent:"  "Date:"  "Status:"  "Original"
	     "From"  "Phase"  "Subject:"  "Fruit"  "Sun"
	     "Lat"  "Buzzword"  "Return"  "Posted" "Telephone"
	     "Postal-Address" "Origin" "X-Sent-By-Nmail-V"
	     "Resent" "X-Location"  "To:" "X-Mailer:"  
	     "Full-Name:" "X-HPMAIL" "Mmdf"
  
  # automatically copy message being replied to into buffer? 
  autocopy = OFF
  
  # save a copy of all outbound messages? 
  copy     = ON
  
  # emulate the mailx message increment mode (only increment after something
  # has been 'done' to a message, either saved or deleted)
  resolve  = ON
  
  # enable the weedout list to be read...
  weed     = ON
  
  # when messages are copied into the outbound buffer, don't include headers
  noheader = ON
  
  # display message title when displaying pages of message
  titles	 = ON
  
.fi
Along with this, there is still an environment variable
that the mailer checks for, namely "EDITOR", which can
also define what editor to use when entering messages.
As with the shell variable, having an editor specified
in the .msgrc file will override anything read in from
the current environment.
.sp 2
.H 1 "The Starting Parameters"
.P
There are a number of starting options to the
.I msg
program, with only one that needs to be remembered: '-?' for help.
.P 0
The flags are;
.VL 10 3
.LI "-a"
Auto Copy.  If this flag is specified 
.I msg
will automatically append
a copy of the message that you are replying to before
entering the editor.  If this flag
is not specified, the program will ask the user if a copy of
the source message is desired on a
message by message basis.   This can 
be automatically defined ON or OFF by using 
the '.msgrc' file entry discussed above.
.LI "-c"
Copy To Self.  If this flag is specified
.I msg
will silently save a copy of each outgoing message to
the file specified by the '.msgrc'
variable "savefile".  This is functionally
equivalent to the '.msgrc' file variable
"copy" which can be turned ON or OFF.
.LI "-d"
Debug.  Useful for debugging the 
.I msg
program.  The results of using the debug option is
much less drastic than in the previous versions of 
the program - it creates a file in your home directory
called "Msg.debug.info" and creates a (verbose) log
of activity as the program is used.  
.LI "-f <file>"
File.  Read specified file rather than the default input mailbox.
.LI "-h"
Help.  Gives a short list of all these options and exit.
.LI "-k"
Keypad - This option, when used, lets the \fImsg\fR program
know that you're on an HP terminal, and it can then interpret
the PREV NEXT and HOME/DOWN-HOME keys accordingly.  If you
are not on an HP terminal, it is recommended that you do
NOT use this option.
.LI "-r"
Resolve.  The default mode for the 
.I msg
mailer is one that parallels the existing Berkeley mailer
in that saved messages are automatically marked for
deletion, deleting a message moves you to the next
message, etc.  Specifying this flag turns that mode off.
This is the same as the '.msgrc' variable "resolve".
.LI "-w"
Weed.  Turn on filter for display of minimal header information
for messages.  This filtering is useful for mail receieved
from distant sites that have dozens of lines of header information.
The default is to have this
.I off.  This is the same as the "weed" option in
the '.msgrc' file.
.sp 
This option weeds out lines from the message starting with either
any of the headers specified as the "weedout" values in 
the '.msgrc' file, or any
of the default headers;
.LE
.VL 15 10
.LI o
>From (typically a forwarding message)
.LI o
Received: (removes one or two lines for each 'hit')
.LI o
Message-Id: (meaningless information!)
.LI o
In-Reply-To: (if a response to a notes message)
.LI o
References: (another form of 'In-Reply-To')
.LI o
Newsgroups: (yet a third form of 'In-Reply-To')
.LE
.VL 10 3
.LI "-z"
Zero.  This causes the mailer not to be started if you don't
have any mail.   This emulates the behaviour of programs
like 'mailx'.
.LE
.P
All the above flags default to reasonable options, so there is
usually no need to use them.   If they are permanently being
used, most can be reconfigured by altering the '.msgrc' file
as discussed above.
.sp 2
.H 1 "The Main System"
.P 1
Upon entry to the program, the main screen will be 
displayed as below;
.sp
.DS
.ce
-----------------------------------------------------------------
.ce
Mailbox is '/usr/mail/mymail' with 13 messages.  [Version 3.0]
.nf

   1<-   Apr 3  rob		Doing anything tonight?
   2     Apr 5  hplabs!joe	bug in gammon game
   3	 Apr 5  root		
   4	 Apr 6  root	        (continuation of previous message)
U  5     Apr 8  decvax!mouse	Re: net.music article decvax:495
   6	 Apr 13 John Jacobs      How can you hate RUSH?
   7     Apr 15 kevin	 	More software requests
N  8	 Apr 18 games		Hi there
N  9	 Apr 18 Dave Taylor	EditFile.c source...
N 10 	 Apr 23 veeger!carl	More silly stuff


.ce 3
!=shell, ?=help, <n>=set current to n, /=search pattern
A)lias, C)hange mailbox, D)elete, F)orward, G)roup reply, M)ail,
N)ext, P)rint, R)eply, S)ave to file, Q)uit, U)ndelete, or eX)it
                                                            
Mail :@
.fi
.ce
-----------------------------------------------------------------
.DE
.sp
.P 
There are a number of things to notice about this screen;
.ML o 5
.LI
The top line always displays the current mail file, 
the number of messages in the file, and the current 
.I msg
version number.
.LI
On the left side of each message is the message
number which is unique for each message in the file.
.LI
The arrow ('<-') always points to the current message.  This is the
message that the commands having default message numbers
(such as D)elete, and N)ext) will work with.
.LI
The date associated with each message is the date the person
.B sent 
the message.  This is obtained by either the oldest of the
">From" line dates, or, if possible, by parsing the "Date:"
line.
.LI 
The third field displayed is a truncated 'from' address, and will
indicate whom the message is from.  Note that on the sixth and
ninth messages full names appear instead of the usual machine!login
format.  This is because these messages have a From line of the
form:
.nf
  
	From: fullname <address>
or      From: address (fullname)

.fi
which the mailer reads and displays if possible.  The \fImsg\fR
mailer (version 2.1 and beyond) also generates this header line on
outgoing mail.
.LI
The final field is the (optional) subject of the message.  Note
that message 3 has no subject.
.LI
Message five is an 'Urgent' message (it contains the header
.nf

	Priority: Urgent

.fi
to make it urgent) that should be read immediately.
.LI
Messages 8 thru 10 are new since the last time the user read their
mail - the "N" in the leftmost margin indicates this.
.LI
A maximum of ten messages are displayed at one time*.
.FS
* On terminals with greater than 25 lines, more messages will be 
displayed automatically.  
.FE
Further into
the document we'll learn how to change 'pages' in the mailbox. 
.LI
The three line mini-menu will always 
indicate what commands are available at 
the current moment.  
' This display can be inhibited by the '-m' (menu) starting option.
.LI
Finally, the '@' character indicates where the cursor would be, awaiting
your input.
.LE
.P
The typical action at this point is to use the 
.I <return>
key to read the current message.  This particular option isn't
noted in the mini-menu, but choosing the '?=help' option will
inform you of a number of choices other than those in the 
basic menu!
.P
Pressing this key will clear the screen and display the first page
of the message.  At the bottom of the page, the system will write
either;
.P 0
Please press <space> to continue		<xx> lines left.
.P 1
or
.P 0
Please press <space> to return
.P 0
These indicate how much of the current message has been read: 'continue'
indicates the presence of
at least one more line of information (the exact number will
be indicated on the right hand side as 'xx lines left').  Pressing
<return> rather than <space> will automatically return you to the main
system level at any page of a message.
.P
When the message continues onto another page the \fImsg\fR mailer will
also indicate how many lines are left in the message...
.P
If resolve-mode is turned off (see the 'resolve' flag)
the current message pointer 
(the arrow) will be incremented after reading the message
and will point to the next message in
the list.  
.P
As you can see, it would be quite simple to quickly read through
all the pending mail by repeatedly using the
.I <return>
command at the menu level, and the <space> bar while reading 
each message!
.P
While reading is perhaps the most fundamental function that the
.I msg
program performs, there are a number of other options available,
namely;
.sp
.VL 25 0 1
.LI "Command"
Action
.LE
.sp
.VL 22 3 1
.LI "!"
Shell escape.
.LI "?"
A help screen listing commands
.LI "+, <space>, or <NEXT>"
Next page of headers
.LI "-, or <PREV>"
Previous page of headers
.LI "=, or <HOME>"
Set current message to 1
.LI "*, or <SHIFT>-<HOME>"
Set current to last message.
.LI "<n>"
Set current message to n
.sp
.LI "a"
Alias, change to 'alias' mode 
.LI "c"
Change current mail file
.LI "d"
Delete current message
.LI "f"
Forward message to specified user
.LI "g" 
Group reply - reply to everyone who received the current message
.LI "h"
Display message + headers
.LI "j"
Increment current message by one
.LI "k"
Decrement current message by one
.LI "m"
Mail to arbitrary user(s)
.LI "n or <return>"
Next message (Read current, then increment)
.LI "o"
Option.  Alter current options.
.LI "p"
Print current message.
.LI "r"
Reply to the author of current message
.LI "s"
Save current message to file
.LI "t"
The current time and date is displayed
.LI "q"
Quit - mail deleted, saved in mbox or left.
.LI "u"
Undelete current message
.LI "v"
Variables.  Display current variables.
.LI "x"
Exit - don't record as read, don't save...
.sp
.LI "^L"
Rewrite screen.
.LI "^M (<return>)"
Read current message
.LI "^Q, ^Z, DEL"
Exit - don't record as read, don't save...
.LE
.sp
.P 0
That are all the commands available at the main level of the
.I msg
program!  Now you can see why it is nice to leave the three-line
menu displayed!
.sp 2
.P
As an example, let's enter a series of commands and indicate
what the display would be after each one;
.sp
.P 0
First off, let's go to the next page of mail with '+';
.sp
.DS
.nf
.ce
-----------------------------------------------------------------
.ce
Mailbox is '/usr/mail/mymail' with 13 messages.  [Version 3.0]
.nf

N 11<-    Apr 27 Jack		Wanna buy some albums cheap?
N 12      Apr 28 Jack		Cancel the previous offer!
N 13	  Apr 30 sdcsvax!dx	Moving day (long)		









.ce 3
!=shell, ?=help, <n>=set current to n, /=search pattern
A)lias, C)hange mailbox, D)elete, F)orward, G)roup reply, M)ail,
N)ext, P)rint, R)eply, S)ave to file, Q)uit, U)ndelete, or eX)it

Mail :@
.fi
.ce
-----------------------------------------------------------------
.DE
.P 1
We need to move the current message pointer to message 11, so
type in '11', then let's read the new current message by
using the 
.I next
command (typing <return>)...
.sp 
.DS
.nf
.ce
-----------------------------------------------------------------
.sp
Message #11 from Jack  		Mailed December 7, 1984 at 8:45 pm

Hey Dave! I've got some old AC/DC and KISS albums, and as I know
you are a collector, do you want to buy them off of me before
I make ashtrays out of them (or frisbees...)?

			Humourously,
					Jack The Gripper







Please press <space> to return: @
.sp
.ce
-----------------------------------------------------------------
.DE
.sp
.fi
.P
Needless to say, we can't let this message go by without replying!
So let's press the <space> bar to return to the main menu, 
then use the
.I "reply"
command to respond.
.P
After pressing the 'r' key, the program asks if a copy of the source
message is desired (the character under the cursor indicates the
default if <return> is pressed.  In this case, the default is 'no');
.sp
.nf
copy source message? (y/n) @
.fi
.P
We choose to answer no, so press the 'n' key.  Next 
.I msg
verifies that the subject is okay;
.sp
.nf
Subject: Re: Wanna buy some albums cheap?@
.fi
.sp
Typing anything other than <return> will allow us
to change the subject to something more appropriate.
Furthermore, if we choose to type our "kill line"
character (the same as the one the shell uses,
probably Control-U or Control-X) the entire line will
be erased.
We decide, however, to leave it be and press return.
.sp
Finally, we're asked if we want to send copies of this
message to anyone.  We don't, so we press <return> one
more time.
.P
The program then puts us
in the
.I vi
editor (the default, assuming no other editor specified 
by the '.msgrc' variable "editor") with a blank file.
.P
After having entered a suitable reply, and left the editor,
the 
.I msg
system then verifies that we really want to send the message with;
.sp
Are you sure you want to send this message? (y/n) @
.sp
To which the response is 'y' for 'yes'.  It then sends the message off
to Jack, who will receive it hopefully quite soon (or at least
before he makes ashtrays out of the albums!)
.sp
.P
Also, if we have a file called \fB".msgheaders"\fR in our home
directory, the mailer will include those headers in the 
outbound message.  This is to allow custom (personalized)
mail, especially headers like "Organization:" and "Location:".
.sp
.P
Message 11 is still the current message,
so, now that we have saved it, let's mark it for deletion by
using the
.I delete
command 'd'.
.P
The screen is now;
.sp
.nf
.DS
.ce
-----------------------------------------------------------------
.ce
Mailbox is '/usr/mail/mymail' with 13 messages.  [Version 3.0]
.nf

N 11    * Apr 27 Jack		Wanna buy some albums cheap?
N 12<-    Apr 28 Jack		Cancel the previous offer!
N 13	  Apr 30 sdcsvax!dx	Moving day (long)		
 









.ce 3
!=shell, ?=help, <n>=set current to n, /=search pattern
A)lias, C)hange mailbox, D)elete, F)orward, G)roup reply, M)ail,
N)ext, P)rint, R)eply, S)ave to file, Q)uit, U)ndelete, or eX)it

Mail :@
.fi
.ce
-----------------------------------------------------------------
.DE
.sp
.P
Now lets go back to the first page of messages by typing '=';
.sp
.DS
.ce
-----------------------------------------------------------------
.ce
Mailbox is '/usr/mail/mymail' with 13 messages.  [version 2.2]
.nf

   1<-   Apr 3  rob		Doing anything tonight?
   2     Apr 5  hplabs!joe	bug in gammon game
   3	 Apr 5  root		
   4	 Apr 6  root	        (continuation of previous message)
U  5     Apr 8  decvax!mouse	Re: net.music article decvax:495
   6	 Apr 13 John Jacob       How can you hate RUSH?
   7     Apr 15 kevin	 	More software requests
N  8	 Apr 18 games		Hi there
N  9	 Apr 18 Dave Taylor	EditFile.c source...
N 10	 Apr 23 veeger!carl	More silly stuff



.ce 3
!=shell, ?=help, <n>=set current to n, /=search pattern
A)lias, C)hange mailbox, D)elete, F)orward, G)roup reply, M)ail,
N)ext, P)rint, R)eply, S)ave to file, Q)uit, U)ndelete, or eX)it

Mail :@
.ce
-----------------------------------------------------------------
.DE
.fi
.sp
.P
Gee..note five not only looks mildly interesting but it's an 
Urgent message too!  So 
let's read it by typing '5'<return>
to make that the current message, and press <return> again
to read it.  After reading
the message we decide that this seems like a message worth
keeping in the 'music' mailbox, so lets do that by using
the 
.I "save to file"
command!
.P
Pressing 's' results in the 
.I msg
system prompting;
.P 0
Save to what file : @
.P 0
to which we reply '=/music'.  The file is then saved in the
directory we specified as mail home via the '.msgrc'
variable "maildir". After saving, the "Mail:"
prompt returns, with message 5 marked for deletion and the
current message pointer incremented to message 6.
.P
Before we finish up, we suddenly remember that one of the 
messages was supposed to be about how to write decent 
documentation for Unix systems, so let's try to find it...
.P
First off, we'll move back to message one with the <HOME>
key (you'll need to use the "-k" starting option and be on
an HP terminal for this to work!) and then use the '/'
pattern matching command:
.nf

Mail: Pattern		      / = match anywhere in messages
Match pattern: @

.fi
we'll type in 'document' and see if the system can find it.
After a brief second or two it returns 'pattern not found.'
Hmm...maybe it's not either the from or the subject of
any of the messages...In case, let's try using the new
.I "match anywhere in message" 
command;
.nf

Mail: @

.fi
To which we type '/' for pattern matching;
.nf

Mail: Pattern		      / = match anywhere in messages
Match pattern: @

.fi
Now we'll use '/' again to get the match anywhere in file
option, and then get the prompt;
.nf

Match pattern (in entire mailbox): @

.fi
to which we respond 'document' again.  
.P
The
.B msg
mailer then searches through each line of all the messages in 
the file and moves the current message pointer to message 
number 7.  A quick check reveals that this message indeed
contains the word 'document', but it's not the one we want,
so we're going to just get outta here!
.P
We've had enough mail for today, so lets quit, saving
all messages in our mailbox as defined in the '.msgrc' file, except
messages 5 and 11, which are marked for deletion.
.P
.I Quit
prompts;
.sp
.nf
Delete messages? (y/n) @
.fi
.sp
to which we answer 'y' for yes.  The next prompt is then;
.sp
.nf
Keep mail in incoming mailbox? (y/n) @
.fi
.sp
To which we also answer yes...the program then quickly saves
the files, removing message 5 and 11 as it goes along, and exits.
.sp
.H 1 "Responses..."
.sp
.P
This section will discuss each command in the 
.I msg
program in more detail than above, including the 
prompts the user can expect upon executing the
command, the meaning of different options etc etc.
.sp
.VL 10 3
.LI !
Shell.  This allows you to send a command to the shell without
exiting the program. 
.LI ?
Help.  This command produces a two-page display that details
all the commands available in a reference guide format.  
.LI \/
Pattern match.  This command, on the top level, allows the
user to search through all the from and subject lines of
the current mailbox starting at the current message and
continuing through the end.  If the first character of the
pattern is a '/', then the program will try to match the
specified pattern against ANY line in the mailbox.  Again,
this works from one after the current message through the
end.
.LI <n>
Specify new current message.  Typing in any of the digits one
thru nine will result in the 
.I msg
program producing the prompt 'Set current to : n', where 'n' is
the digit entered.  
Note that changing the current message to a message not on the 
current page of the headers will result in a new page of headers
being displayed.
.LI a
Alias.  The alias system is a way by which more complex mail addresses
can be shortened for the mail user.  For example;
.P 0
joe, blow : Joe Blow : veeger!hpcnoe!hpcfla!jblow
.P 0
which allows mail to 'joe' with the system expanding
the address properly.  As is obvious, this not only saves remembering
complex addresses, it also allows the address to be optimized to
go through the minimum number of machines without anyone having to
be informed of the change.  A more detailed discussion can
be found in the section entitled 'The Alias System'.
.LI c
Change mailbox.  Specifying this command allows the user to change
the mailbox file that is currently being read.  This is intended 
for perusal and reply to previously archived messages.
The prompt is 'Name of new mailbox : ' and entering <return>
cancels the operation, while entering a filename causes the program
to read that file as the new mailbox file, if possible.
As with the "save" command, this command expands filenames
with '~' being your home directory and '=' being your
MAILDIR directory, if defined.  This command also allows the
special character '!' to be used to allow you to change to
the default incoming mailbox.
.LI "d, u"
Delete and Undelete.  Neither of these two commands have any prompts
and indicate their action by either adding an asterisk to the current
message index entry (indicating deletion pending) or removing the
asterisk (indicating that the deletion is cancelled).
.LI f
Forward.  Allows the user to forward the current message to another user.  
This copies the message into the edit
buffer and allows the user to add their own message too.
The prompt is 'Forward to:' and will expand an alias if
entered.
.LI "j, k"
These two keys work similarly to what they would do in 'vi' or
any of the other screen oriented programs.  The 'j' key moves
the current message pointer down to the next message (going to
the next page if needed) and the 'k' key moves the current
message pointer back to the previous message (also changing 
pages if needed)
.LI m
Mail.  Send mail to a specified user.  The prompt that is associated
with this command is 'Send mail to :'.  Entering an alias name results
in the full address being rewritten in parenthesis immediately.  This
prompt is followed by 'Subject:' which allows the user to title their
note.  The final field is 'Copies to: ', which allows other people
specified to receive "carbon copies" of the message. 
Upon entering all three items the 
.I vi
editor (or any other editor specified by $EDITOR) 
is invoked and the message can be composed.
.LI n
Next message.  See above.
.LI o
Options.  This is a small subsystem of the 
.I msg
system with the various options selected by their first
letter, '1' enabling the option, '0' disabling it
and <return> leaving it unchanged. 'r' returns to
the main system.
.LI p
Print message.  This allows you to print out the current
message to a previously defined printer (see the section
on the '.msgrc' discussing the "print" variable)
.LI q
Quit.  This command's action is dependent on the current state of
the 
.I msg
program.
For example, if the current mailbox is the default mailbox the messages
that are not deleted are saved in the file $home/mbox, whereas
if it is a specified mailbox the to-be-deleted messages are 
removed from the
file.  The possible prompts are 'Save to mailbox?' if the default mailbox
is being read and there is at least one message to save, 'Delete all
messages' if all messages in any mailbox are marked for deletion 
or 'Delete message(s)?'
if not reading the default mailbox and there are some messages that
should be saved.  A response of 'n' (no) to any of these questions will
result in the quit command aborting, and the files being untouched.
.LI r
Reply.  Reply to the author of the current message.  If
the autocopy flag is not specified, the program will 
prompt 'Copy Message? (y/n)' to which the user can specify 
whether a copy of the source message is to be copied into the edit
buffer, or not.  If copied in, all lines from the message are 
prepended with the prefix character sequence, as specified in
the users ".msgrc" file.
.LI s
Save to file.  As demonstrated in the above example, this command
allows the current message to be copied into an arbitrary file.
If there is anything in the file currently the
message is appended to the end, otherwise the file is created
containing only the message.  The prompt for this command
is 'Save to file : '.  A response of <return> cancels the command
and returns the user to the system prompt.
After saving a file, the message is marked for deletion and
the current message pointer is incremented.
There are two available meta-characters when specifying a 
filename too - '~' as the first character expands to your
home directory, and '=' as the first character expands to
the mail folder directory defined via the 'maildir' 
variable in the users ".msgrc" file.
.LI t
Time.  This simply displays the current date and time in a nice
readable format.
.LI v
Variables.  This is also a small subsystem of the 
.I msg
system allowing you to alter the value of various 
.I msg
variables.  The variables that you can change are
the 'EDITOR' variable which determines what editor to 
use when you compose a message,
the 'MAILBOX' variable which indicates where mail is
to be put after being read, and
the 'USERNAME' variable.  (Note that only the superuser
can change their username within the program)
.LI x
Exit.  This is functionally the same as answering 'n'o to the 
.I quit
command prompt, and simply leaves the program in the quickest
possible manner.  This command can also occur from typing
DELETE, control-Q or control-Z, all of which are also 
.I exit
commands.
.LE
.sp 2
.H 1 "Special Outgoing Mail Processing"
.sp
.P
There are a few extra features that the mailer offers on
outgoing mail that are worthy of mention;
.sp
.P
The first, and probably the most exciting feature, is the
ability to send \fBencrypted\fR mail!  To do this is 
extremely simple:  You need merely to have two 'key lines'
"[encode]" and "[clear]" in the message body.
.P
Consider the following outgoing message:
.nf

	Joe,
		Remember that talk we had about Amy?  Well,
	I talked to my manager about it and he said...

	uhh...better encrypt this...the usual 'key'...

	[encode]

		He said that Amy was having family problems
	and that it had been affecting her work.

		Given this, I went and talked to her, and 
	told her I was sorry for getting angry.  She said
	that she understood.

		We're friends again!!
	[clear]
	
		Exciting stuff, eh?   

					 Mike

.fi
While this is obviously quite readable while being typed into 
the editor, as soon as the message is confirmed as wanting
to be sent, the \fImsg\fR mailer prompts with;
.nf

	Enter encryption key: @

.fi
and accepts a key (or series of 8 or less characters) without
echoing them to the screen.  After entry, it will ask for the
same key again to confirm it, then *poof* it will encrypt and
send the mail!
.P
If you have the "copy" option enabled, the program will save
your copy of the message encrypted too.  (This is to ensure
the privacy and security of your archived mail too!)
.P
If the mailer doesn't ask for the encryption key, it's because
you don't have the '[encode]' entered as the first 8 characters
of the line.  It MUST be so for this to work!!
.P
On the other end, a person receiving this mail (they must also
be using \fImsg\fR to receive it, since this mailer has a
unique encryption program) will be reading the
message and then suddenly be prompted;
.nf

	Enter decryption key: @

.fi
and will again be asked to re-enter it to confirm.  The
program will then on-the-fly decrypt the mail and display
each line as it is decoded.  The '[clear]' line signifies
that the block to encrypt is done.
.P
For those sites not running \fImsg\fR, I also have
available the encryption code as a separate program
suitable for a filter for use with other mailers...
.sp
.P
The other option on outgoing mail is the ability to
specify what section of the message you want to have
archived (assuming "copy" is enabled) and what section
you don't.  This is most useful for sending out source
file listings and so on...
.P
To indicate the end of the section that should be
saved in the archive, you need merely to have the
line
.nf

	[no save]

.fi
appear by itself on a line.  This will be removed from 
the outgoing mail, and will indicate the last line of
the message in the saved mail.
.sp 2
.H 1 "The Mail Archive File"
.sp
.P
The format of the mail saved to the archive file is also
worth a quick discussion.  Unlike the usual exact copy
of the entire header section, the archived mail has the
following header;
.nf

	From To:<name> 15 Jan 1985 4:54:30 MST
	Original-To: <address>
	Subject: <subject>

	<message body>

.fi
The first line, the 'From' line, is deliberately mangled
with the occurance of the 'To:<name' to ensure that when
you are perusing your archive file with the mailer that
you see WHO the message was TO, since they're all going
to be FROM you!!  The <name> will either be the machine!login
of the person, or, if used as an alias, it will be the 
alias name.
.P
To read this file, you can use the mailer, choosing the 
"C)hange mailbox" command, or start up specifying your
archive file as the mailbox to read.
.sp 2
.H 1 "Using MSG with the Notes System"
.sp
.P
A new and innovative feature in the 3.0 release of the 
.B msg
program is the ability to read files saved by the notes
system and display them as individual messages.  Unfortunately,
the notes software does not currently save a note with
the subject line, however, so the mailer uses the next best
thing and displays each note in the form:
.nf

    1  Apr 5  hplabs!kundler	Note from group net.unix-wizards
    2  Apr 7  hplabs!richards	Note from group net.unix-wizards

.fi
and so on.  The individual notes can be replied to by using the
.I reply
command, as with normal mail, and the mailer will modify it's
behaviour to work with this particular brand of mail file.
.P
How does the mailer know if it's reading a file that contains
normal mail versus a saved set of notes?  By checking the
first line of the file - if it's the header line that notes
emits (ie "/***** host:login / notesgroup / date **/") then
the file is considered to be a notes file.  If not, the default
for unknown files is to assume they're mail files.
.sp 2
.H 1 "The Alias System"
.sp
.P
As mentioned previously, there exists in the
.I msg
system a set of aliases that associate
an arbitrary word (such as a persons name) to a complex
address or group.  
The advantages are readily apparent; rather than
remembering an address of the form;
.P 0
machine1!machine2!machine3! ... !machineN!account
.P 0
the user merely has to remember a single word.  
.P
Two alias tables are available for a each
user within 
.I msg,
namely the system alias file and the users' alias file.  The
system alias file is created and maintained (by the system administrator)
by editing the file '/usr/mail/.alias_text' as described
in the documentation with the 
.I newalias
command, then running the 
.I newalias 
program.
.P
An individual user can also have an alias file which works
in conjunction with the system aliases.  To do this, they
need merely to peruse the documentation for the 
.I newalias
command and create a file as indicated therein.  After 
executing the program, the aliases will be available
for using from within 
.I msg.
.P
The command 
.I checkalias
is also useful to ensure that the aliases
are installed correctly.
.P
Within
.I msg,
however, the alias system acts as an entirely different program, with
it's own commands and own mini-menu.  The menu replaces the
standard mini-menu with;
.sp
.DS
.nf
.ce
---------------------------------------------------------------------
.sp
.ce
Alias commands
.sp
.ce
A)lias current message, C)heck alias, M)ake user alias, R)eturn
.sp 2
Alias: @
.ce
---------------------------------------------------------------------
.sp
.DE
.fi
.P 0
The commands are;
.VL 10 3
.LI a
Alias current message.  
This allows the user to create an alias that has the
return address of the current message as the address field of
the alias.  It prompts for a unique alias name.   Important
note: when you alias an address in this fashion, the mailer
will try to minimize the amount it needs to store by
iteratively comparing machine names in the path with the
machines in the pathalias database.  Once it finds an entry
the address will be saved at that point.   For further 
information, please see the "Msg Alias System Guide".
.LI c
Check alias.  This is a simple way of checking what is in the alias
database - it prompts for an alias name, and returns the address
associated with that name or the error message 'alias not found'
as appropriate.  
.LI m
Make user alias.  This will prompt for a unique alias name and
then for an address.  The information provided will be added
to your individual alias_text file ($home/.alias_text) and 
then added to the database.
.LI r
Return.  Return to the main level of the 
.I msg
program.
.LE
.sp 2
.H 1 "While We're Talking Aliases..."
.P
Another feature worthy of discussion, since it's been getting
lots of veiled references throughout this document, is the system
alias section.  This is implemented using the uucp pathalias 
database, with a file (whose location is specified in the hdrs/sysdefs.h
file - see the Configuration Guide) in the format:
.nf

  hostname <tab> address!%s

.fi
The actual details of the file are, suprise suprise, located in 
the Alias System Users Guide.
.P
Anyway, to use them is quite simple...when specifying the address
of someone, you can either have an alias for them already, resond
to their mail to you, or use the system alias feature!
.P
Enough hype, right?  Okay...to use this feature, you specify an
address by either "machine!person" ignoring if your specific
machine can talk directly to the machine specified, or, if you
prefer the ARPANET addressing scheme, "person@machine".  When
you enter the address as specified, the mailer will quickly
search through the pathalias database file and expand the
specified address to be a legitimate routing address.
.P
What's really nice about this is that the address that we're
going to send to can be either on ARPA, CSNET, BITNET, uucp,
or any other network.  The method of specifying the basic
address is the same regardless!
.P
For example, mail to me could be sent as either "hpfcla!d_taylor"
(or "hpfcla!hpcnof!d_taylor", with the first machine name being
expanded) or "d_taylor@hpfcla".  \fBmsg\fR will expand them
both in the same manner.
.P
As the song goes, check the alias guide...
.sp 2
.H 1 "Expert Mail Users and Debugging the Mailer"
.P
There are some additional facilities available in the
.I msg
mailer for those people who are knowledgable about 
mail protocols, or trying to debug/track down a 
problem.
.P
The 'h' command at the outermost level of the mailer
will display the current message ignoring the current
setting of the 'weed' option.  This is most useful
for answering questions of the form "I wonder what
this guy put in his header?" and such.  This command
does not show up on the mini-menu because it is somewhat
esoteric, but it DOES appear on the '?' help screen (can
you find it there?).
.P
The '@' command at the outermost level of the mailer
will output a screen of debugging information,
including the number of lines and 
offsets of each of the message in the current mailbox.
.P
The '%' command at the outermost level of the mailer
will display the full computed return address of the
current message.
.P
Starting up 
.I msg
with the "-d" debug option will create a file called
.B Msg.debug.info
in your home directory and contain a wealth of useful
information (to me, at least!) to aid in tracking down
what errors are occuring and why.  With this option
on, most everything acts the same with the exception
of when you get new mail while in the mailer - it will
indicate "New mail: N bytes" rather than the usual
"New mail has arrived...hang on...".
.sp
.P
If there are any problems with the mailer,  please try
to recreate the error with the debug option enabled
before sending defect reports my way.
.P
.sp
One final note: all error numbers reported by the program
are defined in the HP-UX Reference Manual in Errno(2).
.sp
.H 1 "Credits and so on"
.P
This mailer has been evolving over the past year or so with
some extremely valuable input from the following people at
Hewlett Packard;
Mark Laubach, Walt Underwood, Tw Cook, Larry Fenske, Rob Sartin,
and of course Carl Dierschow.
There have been many others, to numerous to mention, that
have inspired me with questions like "why can't the 
mailer..." or "why does it do that?"
.P
Also helpful was the ability to have my 'own' machine to 
close up the many many iterative loops that this software
has gone through - since being on a big multi-user machine
tends to slow it down to a standstill...
.P
Finally, it's also been a very useful experience overall,
confirming my beliefs that iterative software design and
keeping a close watch on users (not to mention an open
mind and mailbox!) improves a product manyfold.  
.P
Incidentally, this entire mail system, including this
documentation, is 
.nf

.ce
(C) 1986 Dave Taylor

'   End of documentation