Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (HP-UX-11.11)
Apropos / Subsearch:
optional field

 mail(1)							     mail(1)

      mail, rmail - send mail to users or read mail

      mail [+] [-epqr] [-f file]

      mail [-dt] person ...

      rmail [-dt] person ...

      See mailx(1) and elm(1) for an enhanced user mail interface.

      The mail command, when used without arguments, prints the user's mail,
      message-by-message, in last-in, first-out order.

      For each message, mail prints a ? prompt and reads a line from the
      standard input to determine the disposition of the message.  Commands
      that automatically proceed to the next message exit from mail if mail
      already on the last message.

      mail supports the following commands:

	   <new-line>	  Go on to next message.  Exit if already on last

	   +		  Same as <new-line>.

	   n		  Same as <new-line>.

	   d		  Delete message and go on to next message.

	   p		  Print message again.

	   -		  Go back to previous message.

	   s [files]	  Save message in the named files (default is mbox),
			  mark the message for deletion from the user's
			  mailfile, and proceed to next message.

	   y [files]	  Same as s [files].

	   w [files]	  Save message without its header (the ``From ...''
			  line), in the named files (default is mbox), mark
			  the message for deletion, and go on to next

	   m person ...	  Mail the message to each named person, mark the
			  message for deletion, and go on to next message.

 Hewlett-Packard Company	    - 1 -   HP-UX Release 11i: November 2000

 mail(1)							     mail(1)

	   q		  Put undeleted mail back in the mailfile and stop.

	   EOT (Ctrl-D)	  Same as q.

	   x		  Abort.  Leave original mailfile unchanged and

	   !command	  Escape to the command interpreter and execute

	   ?		  Print a command summary.

	   *		  Same as ?.

    Command-Line Options
      The following command-line options alter printing of the mail:

	   +		  Cause messages to be printed in first-in, first-
			  out order.

	   -e		  Suppresses printing of mail and returns the exit

			       0 = Mail present
			       1 = No mail
			       2 = Other error

	   -p		  Prints all mail without prompting for disposition.

	   -q		  Causes mail to terminate if an interrupt is
			  received.  Normally an interrupt only causes the
			  termination of the printing of the current

	   -r		  Same as +.

	   -f file	  Causes mail to use file (for example, mbox)
			  instead of the default mailfile.

	   -t		  Causes the outbound message to be preceded by each
			  person the mail is sent to.  A person is usually a
			  user name recognized by login (see login(1)).	 If
			  a person being sent mail is not recognized, or if
			  mail is interrupted during input, the file
			  dead.letter will be saved to allow editing and
			  resending.  Note that dead.letter is regarded as a
			  temporary file in that it is recreated every time
			  needed, erasing the previous contents of

 Hewlett-Packard Company	    - 2 -   HP-UX Release 11i: November 2000

 mail(1)							     mail(1)

	   -d		  Causes mail to deliver mail directly.	 This
			  isolates mail from making routing decisions, and
			  allows it to be used as a local delivery agent.
			  Typically this option is used by auto-routing
			  facilities when they deliver mail locally.

      When persons are named, mail takes the standard input up to an end-
      of-file (or up to a line consisting of just a .) and adds it to each
      person's mailfile.  The message is preceded by the sender's name and a

      To denote a recipient on a remote system, prefix person by the system
      name and exclamation mark (see uucp(1)).	Everything after the first
      exclamation mark in person is interpreted by the remote system.  In
      particular, if person contains additional exclamation marks, it can
      denote a sequence of machines through which the message is to be sent
      on the way to its ultimate destination.  For example, specifying
      a!b!cde as a recipient's name causes the message to be sent to user
      b!cde on system a.  System a then interprets that destination as a
      request to send the message to user cde on system b.  This might be
      useful, for instance, if the sending system can access system a but
      not system b.  mail does not use uucp if the remote system is the
      local system name (i.e., localsystem!user).

      The mailfile can be manipulated in two ways to alter the function of
      mail.  The other permissions of the file can be read-write, read-only,
      or neither read nor write to allow different levels of privacy.  If
      changed to other than the default, the file is preserved, even when
      empty, to perpetuate the desired permissions.  The file can also
      contain the first line:

	   Forward to person

      which causes all mail sent to the owner of the mailfile to be
      forwarded to person.  This is especially useful for forwarding all of
      a person's mail to a given machine in a multiple-machine environment.
      In order for forwarding to work properly the mailfile should have
      "mail" as group ID, and the group permission should be read-write.

      rmail only permits the sending of mail.  uucp uses rmail as a security

      When a user logs in, the command mail -e can be used to detect the
      presence of mail, if any, and so indicate.  When terminating, mail
      produces a notification message if new mail arrived while mail was

    Environment Variables
      LC_TIME determines the format and contents of the displayed date and
      time strings.

 Hewlett-Packard Company	    - 3 -   HP-UX Release 11i: November 2000

 mail(1)							     mail(1)

      If LC_TIME is not specified in the environment or is set to the empty
      string, the value of LANG is used as a default for each unspecified or
      empty variable.  If LANG is not specified or is set to the empty
      string, a default of "C" (see lang(5)) is used instead of LANG.  If
      any internationalization variable contains an invalid setting, mail
      behaves as if all internationalization variables are set to "C".	See

      When set, the TMPDIR environment variable specifies a directory to be
      used for temporary files, overriding the default directory /tmp.

    International Code Set Support
      Between HP-UX systems, single- and multi-byte character code sets are
      supported within mail text.  Headers are restricted to characters from
      the 7-bit USASCII code set (see ascii(5)).

      Conditions sometimes result in a failure to remove a lock file.

      After an interrupt, the next message may not be printed.	To force
      printing, type a p.

      Lines that look like postmarks in the message (that is, ``From ...'')
      are preceded by >&gt&gt&gt;.

      mail treats a line consisting solely of a dot (.) as the end of the
      message, except when the rmail -d command is used.

      The maximum allowable line length in mail messages is BUFSIZ bytes as
      defined in /usr/include/stdio.h.	If line length exceeds this limit,
      mail truncates the line starting at beginning-of-line, and uses only
      the trailing BUFSIZ characters.

      Using two separate mail programs to access the same mail file
      simultaneously (usually inadvertently from two separate windows) can
      cause unpredictable results.

      Some sites that have programs that adhere strictly to RFC-822 will
      fail to deliver a message if any of the recipient fields below is


      You can add the RFC-822 commands into the mail program buffer/editor.
      For instance:

 Hewlett-Packard Company	    - 4 -   HP-UX Release 11i: November 2000

 mail(1)							     mail(1)

	   mail user1@domain.com
	   From: user2@domain.com
	   Subject: This is a test
	   To: test_address@domain.com

	   This is a test

      /var/mail/*.lock	       Lock for mail directory
      dead.letter	       Unmailable text
      /tmp/ma*		       Temporary file
      $MAIL		       Variable containing path name of mailfile
      $HOME/mbox	       Saved mail
      /etc/passwd	       To identify sender and locate persons
      /var/mail		       Directory for incoming mail (mode 775, group
			       ID mail)
      /var/mail/user	       Incoming mail for user; that is, the mailfile
			       (mode 660, group ID mail)

      login(1), mailx(1), uucp(1), write(1).

      mail: SVID2, SVID3, XPG2, XPG3

      rmail: SVID2, SVID3

 Hewlett-Packard Company	    - 5 -   HP-UX Release 11i: November 2000