MAIL(1)                                                   MAIL(1)

     NAME
          mail, edmail, sendmail, seemail, aliasmail, smtp, smtpd,
          uk2uk, vwhois, vismon -  mail commands

     SYNOPSIS
          mail [ arg ... ]

          upas/edmail [ -cmpre ] [ -[fF] mfile ]

          upas/sendmail [ -x# ] person ...

          seemail [ -as ] [ -f file ]

          upas/aliasmail name ...

          smtp [ -fdu ] [ -hhost ] [ .domain ] address sender rcpt-
          list

          smtpd [ -d ]

          uk2uk system user

          vwhois people ...

          vismon system

     DESCRIPTION
        Mail
          Mail invokes edmail -m when no persons appear on the command
          line.  It invokes sendmail otherwise.

        Mailbox Editing
          Edmail edits a mailbox.  The default mailbox is
          /mail/box/username/mbox.  The -f and -F command line options
          and the s and S editing commands specify an alternate mail-
          box.  Unrooted path names are interpreted relative to
          /mail/box/username for -f and s and relative to the current
          directory for -F and S.  If the mfile argument is omitted,
          the name defaults to stored.

          The options for edmail are:

          -c        Create a mailbox.
          -r        Reverse: print mail in first-in, first-out order.
          -p        Print all the mail messages without prompting for
                    commands.
          -m        Use a manual style of interface, that is, print no
                    messages unless directed to.
          -f mfile  Read messages from the specified file (see above)
                    instead of the default mailbox.

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

     MAIL(1)                                                   MAIL(1)

          -F mfile  same as -f with different starting point for rela-
                    tive paths (see above).
          -e        Check silently if there is anything in the mail-
                    box; return zero (true) if so, non-zero otherwise.

          Edmail prints messages one at a time, prompting between mes-
          sages.  After printing a prompt edmail reads a line from the
          standard input to direct disposition of the message.  Com-
          mands, as in ed(1), are of the form `[range] command
          [arguments]'.  The command is applied to each message in the
          (optional) range addressed by message number and/or regular
          expressions in the style of ed(1). A regular expression in
          slashes searches among header (postmark) lines; an expres-
          sion in percent signs searches on message content.

          address    to indicate a single message header
          address,address
                     to indicate a range of contiguous message headers
          g/expression/
                     to indicate all message headers matching the reg-
                     ular expression.

          The commands are:
          b          Print the headers for the next ten messages.
          d          Mark message to be deleted upon exiting edmail.
          h          Print the disposition, size in characters, and
                     header line of the message.
          m person ...
                     Mail the message to the named persons.
          M person ...
                     Same as m except that lines typed on the terminal
                     (terminated by EOT) are prefixed to the message.
          p          Print message. An interrupt stops the printing.
          r          Reply to the sender of the message.
          R          Like `r' but with the message appended to the
                     reply.
          s mfile    (Save) Append the message to the specified mail-
                     box (see above).
          S mfile    Same as s with different starting point for rela-
                     tive paths (see above).
          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.
          W file     Same as w with different starting point for rela-
                     tive paths (see above).
          u          Remove mark for deletion.
          x          Exit, without changing the mailbox file.
          ?          Print a command summary.
          |command   Run the command with the message as standard
                     input.
          !command   Escape to the shell to do command.

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

     MAIL(1)                                                   MAIL(1)

          =          Print the number of the current message.

        Sending Mail
          Sendmail takes the standard input up to an end-of-file and
          adds it to each person's mailbox.  When running in an 8½(1)
          window, sendmail automatically puts the window into Hold
          mode (see 8½(1)); this means that previous lines of the mes-
          sage can be edited freely, because nothing will be sent to
          sendmail until the ESC key is hit to exit Hold mode.  With
          option -#, sendmail does not send mail, but instead reports
          what command would be used to send the mail.  With option
          -x, sendmail does not send mail, but instead reports the
          full mail address of the recipient.

          The message is automatically postmarked with the sender's
          name and date.  Lines that look like postmarks are prefixed
          with `>'.

          Person is a login name on the local system, a name for which
          there is an alias, or a network mail address.

        Addressing Conventions
          The local convention for converting addresses is given by
          rewrite rules in /mail/lib/rewrite.  The conventions gener-
          ally used are:

          -    A person containing no `!'  or `@' is considered a
               local user or local alias.  It is passed as an argument
               to aliasmail which returns either the expanded alias or
               local!person if there is no alias of that name.

          -    A canonical network mail address has the form
               machine!...!name, with one or more machines mentioned.

        Aliasmail
          Aliasmail expands mail aliases, its arguments, according to
          alias files.  Each line of an alias file begins with # (com-
          ment) or with a name.  The rest of a name line gives the
          expansion.  The expansion may contain multiple addresses and
          may be continued to another line by appending a backslash.
          Items are separated by white space.

          In expanding a name, the sender's personal alias file
          /mail/box/username/names is checked first.  Then the system
          alias files, listed one per line in /mail/lib/namefiles, are
          checked in order.  If the name is not found, the expansion
          is taken to be local!name.

        Mailboxes
          Incoming mail for a user username is put in the file
          /mail/box/username/mbox.  The mailbox must have append-only
          and exclusive-access mode (see chmod(1)). A user must create

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

     MAIL(1)                                                   MAIL(1)

          his or her own mailbox using the -c option of edmail. Mail-
          boxes are created writable (append-only) but not readable by
          others.

        Misc
          The seemail command notifies when a new message arrives in
          your mailbox.  It reads a log file, default /sys/log/mail,
          of incoming messages.  It runs continuously where it is
          invoked, displaying the names and icons of senders of new
          messages.  The -a flag causes it to initialize by displaying
          all the faces in the log; -s causes it to overwrite multiple
          appearances of the same face rather than repeatedly display-
          ing it.  Vwhois just displays in the seemail window the
          icons of people. Vismon is a version of seemail that con-
          nects to a remote Unix (not Plan 9) system to look for mail
          arriving there.

          Smtp sends the mail message from standard input to the users
          rcpt-list on the host at network address address using the
          Simple Mail Transfer Protocol.  The return address of the
          mail will contain the local system name from the environment
          variable sysname and the user sender. If .domain is given,
          it is appended to the end of the system name.  The -u option
          sends the mail in the standard Unix format instead of RFC822
          format.  The -f flag just prints out the converted message
          rather than sending it to the destination.  The -d option
          turns on debugging output to standard error.

          Smtpd receives a message using the Simple Mail Transfer Pro-
          tocol.  Standard input and output are the protocol connec-
          tion.  The -d option turns on debugging output to standard
          error.  Smtpd is normally run by a network listener such as
          listen(8).

          uk2uk is used by the mail rewrite rules to turn a JANET
          style name into a domain style name, by flipping all the
          components of system, appending !user to it, and writing the
          result to standard output.

     FILES
          /sys/log/mail            mail log file
          /mail/box/*              mail directories
          /mail/box/*/mbox         mailbox files
          /mail/box/*/L.reading    mutual exclusion lock for multiple
                                   mbox readers
          /mail/box/*/L.mbox       mutual exclusion lock for altering
                                   mbox
          /mail/box/*/dead.letter  unmailable text
          /mail/box/*/names        personal alias files
          /mail/lib/rewrite        rules for handling addresses
          /mail/lib/namefiles      lists files to search for aliases
                                   in

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

     MAIL(1)                                                   MAIL(1)

          /lib/face/48x48x?        directories of icons for seemail

     BUGS
          Edmail truncates long headers for searching.

     Page 5                       Plan 9            (printed 12/21/24)