NEDMAIL(1)                                             NEDMAIL(1)

     NAME
          nedmail -  reading mail

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

          upas/nedmail -c dir

     DESCRIPTION
          Nedmail edits a mailbox.  The default mailbox is
          /mail/box/username/mbox.  The -f command line option speci-
          fies an alternate mailbox.  Unrooted path names are inter-
          preted 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.
          -r           Reverse: show messages in first-in, first-out
                       order; the default is last-in, first-out.
          -n           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 pro-
                       duced 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:

          address       to indicate a single message header
          address,address
                        to indicate a range of contiguous message
                        headers
          g/expression/ to indicate all messages whose headers match
                        the regular expression.
          g%expression% to indicate all messages whose contents match
                        the regular expression.

     Page 1                       Plan 9             (printed 12/3/24)

     NEDMAIL(1)                                             NEDMAIL(1)

          The addresses can be:

          number        to indicate a particular message
          address.number
                        to indicate a subpart of a particular message
          /expression/  to indicate the next message whose header
                        matches expression
          %expression%  to indicate the next message whose contents
                        match expression
          empty or .    to indicate the current message
          -address      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.
          b          Print the headers for the next ten messages.
          d          Mark message to be deleted upon exiting nedmail.
          f          Append the message to the file
                     /mail/box/username/sendername where sendername is
                     the account name of the sender.
          h          Print the disposition, size in characters, recep-
                     tion time, sender, and subject of the message.
          H          Print the MIME structure of the message.
          help       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.
          p          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.
          rf         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.

     Page 2                       Plan 9             (printed 12/3/24)

     NEDMAIL(1)                                             NEDMAIL(1)

          Rf         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 desti-
                     nation 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.
          q          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.
          u          Remove mark for deletion.
          x          Exit, without changing the mailbox file.
          y          Synchronize with the mail box.  Any deleted mes-
                     sages are purged and any new messages read.  This
                     is equivalent to quiting nedmail and restarting.
          |command   Run the command with the message body as standard
                     input.
          ||command  Run the command with the whole message as stan-
                     dard input.
          !command   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  noone@madeup.net  "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  xxx@yyy.net  "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   from=noone@madeup.net
           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
          %

     Page 3                       Plan 9             (printed 12/3/24)

     NEDMAIL(1)                                             NEDMAIL(1)

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

     FILES
          /mail/box/*              mail directories
          /mail/box/*/mbox         mailbox files
          /mail/box/*/forward      forwarding address(es)
          /mail/box/*/pipeto       mail filter
          /mail/box/*/L.reading    mutual exclusion lock for multiple
                                   mbox readers
          /mail/box/*/L.mbox       mutual exclusion lock for altering
                                   mbox

     SOURCE
          /sys/src/cmd/upas/ned

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

     Page 4                       Plan 9             (printed 12/3/24)