man(1) Manual page archive


     MAIL(1)                                                   MAIL(1)

     NAME
          mail -  send or receive mail

     SYNOPSIS
          mail [ -mpren ] [ -f file ]

          mail [ -# ] person ...

          mail

          /usr/lib/upas/gone.fishing [ mesg ]

     DESCRIPTION
        Printing Mail
          When persons are not named, mail displays your incoming com-
          puter mail.  The options are:

          -r   Print mail in first-in, first-out order.
          -p   Print all the mail messages without prompting for com-
               mands.
          -m   Use a manual style of interface, i.e., print no mes-
               sages unless directed to.
          -f file
               Use file, e.g.  `mbox', as if it were the mailbox.
          -e   Check silently if there is anything in the mailbox;
               return zero (true) if so, non-zero otherwise.
          -n   Announce mail to the control terminal when it arrives.
               Do not print mail now.

          Mail prints a user's mail, message by message, prompting
          between messages.  After printing a prompt mail reads a line
          from the standard input to direct disposition of the mes-
          sage.  Commands, as in ed(1), are of the form `[range]
          command [arguments]'.  The command is applied to each mes-
          sage in the (optional) range addressed by message number
          and/or regular expressions in the style of regexp(3). A reg-
          ular expression in slashes searches among header (postmark)
          lines; an expression in backslashes searches on message con-
          tent.

          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 for deletion on exiting mail.

     MAIL(1)                                                   MAIL(1)

          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 or `.')  are prepended 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 file     (Save) Append the message to the named file
                     (`mbox' default, in HOME directory if known, see
                     environ(5)).
          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.
          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.
          =          Print the number of the current message.

        Sending Mail
          When persons are named, mail takes the standard input up to
          an end-of-file, or (if input is from a terminal) to a line
          consisting of a single `.'  and adds it to each person's
          mailbox.  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 or a network name
          for a remote system; see mail(6).

          Option -# does not send mail, but reports instead how the
          mail would be sent: the sender, the next machine to handle
          the mail, and the recipient's address relative to that
          machine.  The report reflects address translation; see
          mail(6) and upas(8).

          Sh(1) and vismon(9.1) have mechanisms for timely notifica-
          tion of incoming mail.

        Mailboxes
          Each user owns a mailbox for incoming mail, normally
          /usr/spool/mail/person.  Mail creates mailboxes as neces-
          sary, and never removes them.  Mailboxes are created read-
          able but not writable by others.  For more privacy, a

     MAIL(1)                                                   MAIL(1)

          mailbox's owner may make it unreadable; see chmod(2).

          If a mailbox contains the sole line

               Forward to name,

          mail for that mailbox is sent instead to name. Name may be a
          list of names.  If the mailbox contains

               Pipe to command

          the mail is sent to the standard input of command instead of
          being appended to the mailbox.  The command is run with the
          userid and groupid of the mailbox's owner.  The command is
          sent (see signal(2)) after two minutes.  (On System V
          machines, the set userid bit must be set.)

          Mail checks centralized forwarding lists before looking in
          mailboxes.  If you have accounts on many machines, but wish
          to receive mail on only one, it is usually easier to regis-
          ter in forwarding lists than to install `Forward to' in many
          mailboxes; see upas(8).

          To use mail as an answering machine while you are away,
          replace the contents of your mailbox with a single line like

               Pipe to /usr/lib/upas/gone.fishing /usr/you/mesg

          The mesg file will be sent (just once) to everyone who sends
          you mail; arriving messages will be collected in gone.mail
          in your home directory.  If you do not name a mesg file,
          will be used by default.

     FILES
          mail log file
          mailboxes
          to identify sender and locate persons
          saved mail
          unmailable text
          the program for editing mail
          the program for sending mail
          a link to                 used to receive remote mail
          sions.