mail(1)								      mail(1)



NAME
  mail, binmail - Sends and displays messages

SYNOPSIS

  Reading Mail


  mail [-epq] [-bhr] [-f file]

  binmail [-epq] [-bhr] [-f file]

  Sending Mail


  mail [-d] [-r name] [-h N] user ...  [< file]

  binmail [-d] [-r name] [-h N] user ...  [< file]

DESCRIPTION

  The mail command writes to standard output all stored mail addressed to
  your login name, one message at a time, or sends a mail message to another
  user or users.  Another name for the mail command is binmail.

  Following each message, mail prompts you with a ? question mark.  Press
   to display the next mail message, or enter one of the subcommands
  that control the disposition of the message.

  When sending mail, you specify users, and then mail reads a message from
  standard input until you press the End-of-File key sequence or enter a line
  containing only a . (dot).  It prefixes this message with the sender's name
  and the date and time of the message (its postmark) and adds this message
  to the file /usr/spool/mail/user for each user specified on the command
  line.

  Usually, user is a name recognized by the login command.  If the system
  does not recognize one or more of the specified users or if mail is inter-
  rupted during input, mail saves messages in the file $HOME/dead.letter to
  allow for editing and resending.

  The action of mail can be modified in two ways by manipulating
  /usr/spool/mail/user:

    +  The default permission assignment for other users is read-only.	If
       you change this permission assignment to read/write or to All Permis-
       sions Denied, the system preserves the file, even when it is empty, in
       order to maintain the desired permissions; you will not be able to
       remove the file.

    +  You can edit the file to contain the following as its first line:
	    Forward to person
       This causes all messages sent to user to be sent to person instead.
       The Forward to feature is especially useful for sending all of a
       person's mail to a particular machine in a network environment.

  To specify a recipient on a remote system, prefix the system name and an !
  (exclamation mark) to user.  See the uucp command for a detailed discussion
  of how to address remote systems.  Also see mailx and sendmail for other
  network connections.

  DEC OSF/1 provides locking for the mailbox files.  The style of locking
  used depends on how it is set in the rc.config file.	For more information,
  see the Network Configuration manual.

  Subcommands

  The following subcommands control message disposition.

  +   Displays the next mail message (the same as pressing ).

  -   Displays the previous message.

  d   Deletes the current message and displays the next message.

  p   Displays the current message again.

  s [file]
      Saves the message in file instead of in the default mail file
      $HOME/mbox.

  w [file]
      Saves the message, without its postmark, in file instead of in the
      default mail file, $HOME/mbox.

  m users
      Forwards the current message to users.  If the forward was successful,
      deletes that message and then displays the next message.

  q   Writes any mail not yet deleted to /usr/spool/mail/user and exits.
      Pressing the End-of-File key sequence has the same effect.

  x   Exit, leaving the mail file unchanged.

  !system_command
      Runs the specified command.

  * (asterisk)
      Displays a subcommand summary.

  help
      Displays a subcommand summary.

FLAGS

  Reading Mail

  You can use the following flags when invoking the mail command to read
  mail:

  -e  Does not display any messages.  This flag causes mail to return an exit
      value of 0 (zero) if the user has mail and an exit value of 1 if the
      user has no mail.

  -f file
      Saves mail to and reads mail from file instead of the default mail
      file, /usr/spool/mail/user.

  -p  Displays mail without prompting for a disposition code.  This flag does
      not delete, copy, or forward any messages.

  -q  Causes mail to exit when you press the Interrupt key sequence.  Nor-
      mally, pressing the Interrupt key sequence stops only the message being
      displayed.  (In this case, the next message sometimes does not display
      until you enter the p subcommand.)

  -b  Displays mail in first-in, first-out order.  The default is last-in,
      first-out.

  -r  Alternate and obsolete form of the -b flag.

      If -r is the first flag specified and more arguments follow, send mail
      mode is assumed.

  -h  Alternate and obsolete form of the -b flag.

      If -h is the first flag specified and more arguments follow, send mail
      mode is assumed.

  Sending Mail

  You can use the following flags when invoking the mail command to send
  mail:

  -h N
      Sets the hop count to N. The hop count is incremented every time the
      mail is processed.  When it reaches a limit, the mail is returned with
      an error message, the victim of an aliasing loop.	 If you do not
      specify this flag, received lines in the message are counted.

  -r name
      Sets the name of the From: user field (that is, the sender of the
      mail).  The -r flag can only be used by trusted users (normally root,
      daemon, and network) or if the person you are trying to become is the
      same as the person you are.

  -d  Informs binmail to actually deliver the mail instead of passing it off
      to the sendmail program for delivery.

EXAMPLES

   1.  To display your mail, enter:
	    mail

       After the most recent message is displayed, a ? (question mark) indi-
       cates that mail is waiting for one of the subcommands explained previ-
       ously (+, -, d, p, and so on).  Enter help or an * (asterisk) to list
       the subcommands available.

   2.  If the End-of-File key sequence is , you send mail to other
       users by entering:
	    mail tom rachel
	    Do not forget the meeting tomorrow at 9:30.
	    

       In this example, the system mails the message Do not forget the meet-
       ing tomorrow at 9:30. to the users tom and rachel.  The End-of-File
       key sequence (in this case, ) indicates the end of the mes-
       sage, but it is not sent with the text.

   3.  To send a file to another user, enter:
	    mail fran < proposal

       This command sends the contents of the file proposal to fran.

   4.  To save a message to the default mail file, enter:
	    mail

       This command displays each message mailed to you.  Press 
       after the ? prompt until the desired message is displayed.

       When the appropriate message is displayed, enter:
	    s

       The message is saved in the default mail file, $HOME/mbox.

   5.  To save a message to a specific file, enter:
	    mail

       This command displays each message mailed to you.  Press 
       after the ? prompt until the desired message is displayed.  When the
       appropriate message is displayed, enter:
	    s mycopy

       This command saves the message in a file named mycopy in the current
       directory, rather than in the default mail file.

RETURN VALUES

  For information about exit values, see the FLAGS section.

NOTES

  The binmail program is not RFC 822 compliant.	 This affects messages that
  begin withlines that look like header lines.	Header lines begin with a
  string followed by a colon (:) (such as those found in the /etc/passwd
  file).  Use mailx command to send such messages, or make sure the message
  is preceded by a blank line.

FILES

  $HOME/mbox Holds saved mail.

  $HOME/dead.letter
	     Holds unmailable text.

  /etc/passwd
	     Contains user information.

  /usr/spool/mail/user
	     Holds incoming mail for user.

  /usr/spool/mail/user.lock
	     Lock for mail directory.  (Note: this file is not created if
	     lockf is used for locking.

RELATED INFORMATION

  Commands:  login(1), mailx(1)/Mail(1), sendmail(8), write(1), uucp(1).