nedmail – reading mail


upas/nedmail [ -nr ] [ -f mailfile ] [ -s mailfile ]

upas/nedmail -c dir


Nedmail edits a mailbox. The default mailbox is /mail/box/username/mbox. The -f command line option specifies an alternate mailbox. Unrooted path names are interpreted relative to /mail/box/username. If the mailfile argument is omitted, the name defaults to stored.

The options are:

-c dir

Create a mailbox. If dir is specified, the new mailbox is created in /mail/box/username/dir/mbox. Otherwise, the default mailbox is created.  


Reverse: show messages in first-in, first-out order; the default is last-in, first-out.  


Make the message numbers the same as the file names in the mail box directory. This implies the -r option.  

-f mailfile

Read messages from the specified file (see above) instead of the default mailbox.  

-s mailfile

Read a single message file mailfile, as produced by fs, and treat it as an entire mailbox. This is provided for use in plumbing rules; see faces(1).  

Nedmail starts by reading the mail box, printing out the number of messages, and then prompting for commands from standard input. Commands, as in ed(1), are of the form ‘[range] command [arguments]’. The command is applied to each message in the (optional) range.

The address range can be:


to indicate a single message header  


to indicate a range of contiguous message headers  


to indicate all messages whose headers match the regular expression.  


to indicate all messages whose contents match the regular expression.  

The addresses can be:


to indicate a particular message  


to indicate a subpart of a particular message  


to indicate the next message whose header matches expression  


to indicate the next message whose contents match expression  

empty or .

to indicate the current message  


to indicate backwards search or movement  

Since messages in MIME are hierarchical structures, in nedmail all the subparts are individually addressable. For example if message 2 contains 3 attachments, the attachments are numbered 2.1, 2.2, and 2.3.

The commands are:

a args

Reply to all addresses in the To:, From:, and Cc: header lines. Marshal is used to format the reply and any arguments the user specifies are added to the command line to marshal before the recipient. The possibility of making a fool of yourself is very high with this command.  

A args

Like a but with the message appended to the reply.  


Print the headers for the next ten messages.  


Mark message to be deleted upon exiting nedmail.  


Append the message to the file /mail/box/username/sendername where sendername is the account name of the sender.  


Print the disposition, size in characters, reception time, sender, and subject of the message.  


Print the MIME structure of the message.  


Print a summary of the commands.  

m person ...

Forward the message as a mime attachment to the named persons.  

M person ...

Like m but allow the user to type in text to be included with the forwarded message.  


Print message. An interrupt stops the printing.  

r args

Reply to the sender of the message. Marshal is used to format the reply. If any optional args are specified, they are added to the command line to marshal before the recipient’s address.  

R args

Like r but with the original message included as an attachment.  


Like r but append the message and the reply to the file /mail/box/username/sendername where sendername is the account name of the sender.  


Like R but append the message and the reply to the file /mail/box/username/sendername where sendername is the account name of the sender.  

s mfile

Append the message to the specified mailbox. If mfile doesn’t start with a ‘/’, it is interpreted relative to the directory in which the mailbox resides. If mfile is a directory then the destination is a file in that directry. If the MIME header specifies a file name, that one is used. Otherwise, one is generated using mktemp(2) and the string att.XXXXXXXXXXX.  


Put undeleted mail back in the mailbox and stop.  

EOT (control-D)

Same as q.  

w file

Same as s with the mail header line(s) stripped. This can be used to save binary mail bodies.  


Remove mark for deletion.  


Exit, without changing the mailbox file.  


Synchronize with the mail box. Any deleted messages are purged and any new messages read. This is equivalent to quiting nedmail and restarting.  


Run the command with the message body as standard input.  


Run the command with the whole message as standard input.  


Escape to the shell to do command.  


Print the number of the current message.  

Here’s an example of a mail session that looks at a summary of the mail messages, saves away an html file added as an attachment to a message and then deletes the message:

% mail
7 messages
: ,h
1   H  2129	07/22 12:30  "Add Up To 2000 free miles"
2       504	07/22 11:43  jmk
3   H   784	07/20 09:05  presotto
4       822	07/11 09:23  "You don't call, you don't write..."
5       193	07/06 16:55  presotto
6       529	06/01 19:42  jmk
7       798	09/02  2000  howard
: 1H
1       multipart/mixed             2129
 1.1      text/plain                115    
 1.2      text/html                 1705   filename=northwest.htm
: 1.2w /tmp/northwest.html
!saved in /tmp/northwest.html
1.2: d
1: q
!1 message deleted

Notice that the delete of message 1.2 deleted the entire message and not just the attachment.



mail directories  


mailbox files  


forwarding address(es)  


mail filter  


mutual exclusion lock for multiple mbox readers  


mutual exclusion lock for altering mbox  




mail(1), aliasmail(8), filter(1), marshal(1), mlmgr(1), nedmail(1), upasfs(4), smtp(8), faces(1), rewrite(6)