unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (OSF1-V5.1-alpha)
Page:
Section:
Apropos / Subsearch:
optional field



mailx(1)							     mailx(1)



NAME

  mailx, Mail -	Sends and receives mail

SYNOPSIS

  Sending Mail


  mailx	[-dinvF] [-h number] [-r address] [-s subject] user...

  Mail [-dinvF]	[-h number] [-r	address] [-s subject] user...

  Handling Mail


  mailx	[-dinNveH] -f  [file]

  Mail [-dinNveH] -f  [file]

  mailx	[-dinNveH] [-u user]

  Mail [-dinNveH] [-u user]

  The mailx and	Mail commands allow you	to read, write,	send, receive, store,
  and discard mail messages.

  [Tru64 UNIX]	See the	section	Internationalization under the DESCRIPTION
  section for more information about the internationalization features of the
  mailx	command.

STANDARDS

  Interfaces documented	on this	reference page conform to industry standards
  as follows:

  mailx():  XCU4.2

  Refer	to the standards(5) reference page for more information	about indus-
  try standards	and associated tags.

OPTIONS

  -d  Causes the mailx command to display debugging information. Messages are
      not sent while in	debug mode.

  -e  Tests for	the presence of	mail.  The mailx command prints	nothing	and
      exits with a successful return code if there is mail to read.

  -f file
      Reads in the contents of your mbox or the	specified file for process-
      ing.  When you quit, mailx writes	undeleted messages back	to this	file.

  -F  Records the message in a file named after	the first recipient. Over-
      rides the	record option, if set.

  -h number
      Specifies	the number of network "hops" made so far.  This	is provided
      for network software to avoid infinite loops.

  -H  Prints header summary only.

  -i  Ignores tty Interrupt signals.  Useful when using	mailx on noisy phone
      lines.

  -n  Inhibits the reading of the /usr/share/lib/Mail.rc file.

  -N  Suppresses the initial printing of headers.

  -r address
      Changes sender's address to address. The original	sender must be a
      trusted user. See	sendmail(8) for	more information on trusted users.

  -s subject
      Specifies	a subject for a	message	to be created.

  -u user
      Activates	mailx for a specified users mailbox; short way of doing	mailx
      -f /var/spool/mail/user.	You must have access permission	to the speci-
      fied user's mailbox.

  -v  Puts mailx into verbose mode.  Details of	delivery are displayed on the
      user's terminal.

DESCRIPTION

  The mailx and	Mail commands allow you	to do the following:

    +  Compose a message and send it.

    +  Receive a message and look at it.

    +  Store received messages in your mailbox or in folders.

    +  Discard messages.

  The mailx command uses two types of mailboxes:  the system mailbox and the
  personal mailbox.  The system	mailbox	is a file assigned to a	particular
  user.	 The file is created when mail arrives for a user ID, and it is
  deleted when all the messages	are removed from the file.  It is not deleted
  if you have specified	the keep option	in your	.mailrc	file, or if the
  /var/spool/mail directory has	no write permissions for other.	 A separate
  system mailbox can exist for each user ID on the system. The mailx command
  keeps	all system mailboxes in	the directory /var/spool/mail.	Each system
  mailbox is named by the user ID associated with it.  For example, if your
  user ID is jeanne, then your system mailbox is /var/spool/mail/jeanne.

  The personal mailbox is a file assigned to a particular user.	 The mailx
  command creates a file with the name $HOME/mbox when you receive mail	from
  the system mailbox.  For example, if your home directory is /u/lance,	the
  mailx	command	creates	the file /u/lance/mbox as your personal	mailbox.  The
  system deletes this file when	all messages are removed from the personal
  mailbox.  When you use the mailx command to view mail	in your	system mail-
  box, the mailx command automatically puts all	messages that you have read
  but did not delete into your personal	mailbox.  The messages remain in your
  personal mailbox until you move them to a folder or delete them.

  Folders provide a way	to save	messages in an organized fashion.  You can
  create as many folders as you	need.  Name each folder	according to the
  subject matter of the	messages that it contains.  Using the mailx command,
  you can put a	message	into a folder from your	system mailbox,	from your
  personal mailbox, from the dead.letter file, or from another folder.

  To send a message to one or more persons, enter mailx	on the command line
  with arguments that are the network addresses	of the people you want to
  receive the message. When mailx starts, you can type the message using an
  editor such as ed.  When you are finished with the message, press <&lt;Return>&gt;
  at the end of	a line,	and use	an End-of-File key sequence at the beginning
  of the next line to exit the editor and send the message.

  When mail arrives for	you from another user, the mail	system puts the	mail
  in your system mailbox (/var/spool/mail/user).  The command shell will
  notify you that mail has arrived before displaying its next prompt (that
  is, notification is synchronous), provided that the MAIL environment vari-
  able is set and the interval specified by MAILCHECK (mail for	csh) has
  elapsed since	the shell last checked for mail.  If you are logged in,	the
  shell	sends a	message	to your	terminal to tell you that new mail has
  arrived.  If you are not logged in, a	message	is sent	to your	terminal the
  next time you	log in.	 The notification message is the value of the MAILMSG
  environment variable.	 The default message is	as follows:

       [YOU HAVE NEW MAIL]

  To look at the contents of your mailbox, enter the mailx command without
  options on the command line.	The program displays a listing of the mes-
  sages	in your	mailbox	and allows you to look at them,	reply to them, save
  them,	dispose	of them, and so	on.

  [Tru64 UNIX]	Tru64 UNIX provides locking for	the mailbox files.  The	style
  of locking used depends on how it is set in the rc.config.common file.  For
  more information, see	mail_manual_setup(7).

  Reading Incoming Mail


  To receive and read incoming mail, enter mailx with no arguments:

       mailx

  The mailx command then checks	your system mailbox (/var/spool/mail/user)
  and displays a one-line entry	for each message in the	system mailbox simi-
  lar to the following:

       "/var/spool/mail/geo": 2	messages 2 new
       >&gt;N  1 amy       Thu Sep 17 14:36	 13/359	"Dept Meeting"
	N  2 amy       Thu Sep 17 16:28	 13/416	"Dept Meeting Delayed"
       ?

  The >&gt;	(right angle bracket) indicates	the current message, or	the message
  that subcommands act on if you do not	specify	a message number or list of
  message numbers.  The	first field for	each message contains a	one-letter
  indicator of the status of the message.  Possible indicators are as fol-
  lows:

  M   The message is stored in your personal mailbox.

  N   The message is new.

  P   The message is held (preserved) in your system mailbox.

  R   You have read the	message.

  U   The message is unread.  The message was listed in	the mailbox before,
      but you have not looked at the contents of the message.

  *   You have saved or	written	the message to a file or folder.

  no indicator
      The message was read, but	was not	deleted	or saved.


  The other fields in the listing (in order) represent:

  Message Number
      The number that mailbox subcommands use to refer to the message.

  Address
      User address of the sender.

  Date
      Date the message was received, including day of the week,	month, day,
      and time.

  Size
      Size of the message in number of lines and characters, including header
      information.

  Subject
      The contents of the subject field	of the message,	if the message has
      one.

  From the mailbox prompt (?), you can enter subcommands to look at, reply
  to, save, discard, or	otherwise manage the contents of the mailbox.  To
  display a summary of some of the subcommands that you	can use	to handle
  mail in your mailbox,	enter a	? (question mark) at the mailbox prompt.
  Note that the	behavior of the	<&lt;Return>&gt; key has changed for XCU4.2 compli-
  ance.	 Using this key	with no	following argument now causes the current
  message to be	displayed, and not the next message.

  Many mailbox subcommands allow you to	specify	groups of messages upon	which
  to perform the subcommand.  Subcommands that allow groups of messages	use
  the argument message_list in the command format.  For	example, the format
  of the from (or f) subcommand	(display information about messages) appears
  as:

       ? from [message_list]

  In this format, message_list can be one of the following:

    +  One or more message numbers separated by	spaces.	 For example:


	    ? f	1 2 4 7

    +  A range of message numbers indicated by the first and last numbers in
       the range separated by a	dash.  For example, the	following subcommand:


	    ? f	2-5

       is the same as:


	    ? f	2 3 4 5

    +  An example of one or more addresses separated by	spaces to apply	the
       subcommand to messages received from those addresses follows:


	    ? f	amy geo@zeus

       The characters entered for an address need not match the	address
       exactly.	 They must only	be contained in	the address field of the mes-
       sages in	either uppercase or lowercase letters.	Therefore, the
       request for address amy matches all of the following addresses (and
       many others):

	 -- amy

	 -- AmY

	 -- amy@zeus

	 -- hamy

    +  A string, preceded by a / (slash), to match against the Subject:	field
       of the messages follows:


	    ? f	/meet

       This applies the	subcommand to all messages whose Subject: field	con-
       tains the letters meet in uppercase or lowercase. The characters
       entered for a match pattern do not have to match	the Subject: field
       exactly.	 They must only	be contained in	the Subject: field of the
       messages	in either uppercase or lowercase.  Therefore, the request for
       subject meet matches all	of the following subjects (and many others):

	 -- Meeting on Thursday

	 -- Come to meeting tomorrow

	 -- MEET ME IN ST. LOUIS

  The special character	. (dot)	addresses the current message, * (asterisk)
  addresses all	messages, ^ (circumflex) addresses the first undeleted mes-
  sage,	and $ (dollar sign) addresses the last message.	The character
  sequence :c addresses	all messages of	type c,	where c	is one of the follow-
  ing:

  d   Deleted messages

  n   New messages

  o   Old messages

  r   Read messages

  u   Unread messages

  All commands that take a message list	will default to	the current message
  number if no list is specified.

  When the mailx command is processing a mailbox, the mailbox prompt (?) is
  displayed to indicate	that it	is waiting for input.  When this prompt	is
  displayed, you can enter any of the following	mailbox	subcommands.  The
  subcommand abbreviation in parentheses can be	used instead of	the full sub-
  command name.

  =   Echoes the number	of the current message.

  #   Allows you to write comments in mail script files.

  -n  Goes to the previous message and displays	it.  If	given a	number argu-
      ment of n, goes to the nth previous message and displays it.

  ?   Displays a brief summary of mailbox subcommands.

  !shell_command
      Executes shell_command.

  alias	[alias]	[address_list] (a)
      Displays all currently defined aliases.  With the	argument of a
      previously defined alias,	displays the expansion of the alias. With at
      least two	arguments, alias and address_list (a space-separated list of
      addresses), creates a new	alias or changes an old	alias.	Identical to
      the group	subcommand.

  alternates alternate_list(alt)
      Informs mailx that the addresses listed in alternate_list	all refer to
      you. The alternates subcommand is	useful if you have accounts on
      several machines.	Then, when you reply to	messages, mailx	does not send
      a	copy of	the message to any of the addresses given in alternate_list.
      If you enter the alternate subcommand with no argument, mailx displays
      the current set of alternate names.

  chdir	directory (cd, ch)
      Changes your working directory to	directory.  If no directory is given,
      it changes to your login directory.

  copy [message_list] file(c, co)
      Appends each message in message_list in turn to the end of file.
      Displays the filename in quotes, followed	by the line count and charac-
      ter count, on your terminal. Does	not mark the appended messages for
      deletion when you	quit.

  Copy [message_list] (C)
      Saves the	specified messages in a	file whose name	is derived from	the
      author of	the message to be saved, without marking the messages as
      saved.  Otherwise	equivalent to the Save subcommand.

  delete [message_list]	(d)
      Marks the	messages in message_list to be deleted when you	quit mailx.
      Deleted messages are not saved in	mbox, nor are they available for most
      other subcommands. However, you can restore messages that	you have
      deleted while in the same	mailbox	session	(see the undelete subcom-
      mand). If	you delete a message and either	change to another mailbox or
      quit the mailbox with the	quit subcommand, the deleted message cannot
      be recalled.

  discard [field_list] (di)
      Identical	to the ignore subcommand.

  dp  Deletes the current message and displays the next	message.  If there is
      no next message, mailx displays the message, at EOF.

  dt  Identical	to the dp subcommand.

  echo string (ec)
      Displays the character string string on the command line.

  edit [message_list] (e)
      Invokes the alternate editor that	you can	define with the	set EDITOR=
      statement	and loads message_list into the	editor.	When you exit the
      editor, any changes made during the editing session are saved in the
      messages in message_list.	The default editor is /usr/bin/ex.

  exit (ex or x)
      Exits to the shell without changing the mailbox being processed.	The
      mailbox returns to the condition that it was in when mailx was started.
      Messages marked to be deleted are	not deleted.  Identical	to the xit
      subcommand.

  file [name] (fi)
      Identical	to the folder subcommand.

  folder [name]	(fold)
      Switches to a new	mail file or folder.  With no arguments, displays the
      name of the mailbox that you are currently reading. If an	argument is
      included,	it stores the current mailbox with changes (such as messages
      deleted) and reads in the	new mailbox specified by the name argument.
      Identical	to the file subcommand.

      Some special conventions are recognized for the name:

      #	  Refers to the	previous file.

      %	  Refers to the	system mailbox (/var/spool/mail/user).

      &&amp;	  Refers to your personal mailbox ($HOME/mbox).

      +name
	  Refers to a file in your folder directory (determined	by the value
	  of the folder	option;	see Enabling and Disabling Options).

  folders
      Lists the	names of the folders in	your folder directory (see the folder
      option in	Enabling and Disabling Options).

  followup [message] (fo)
      Responds to a message, recording the response in a file whose name is
      derived from the author of the message.  Overrides the record option,
      if set.  (See also the Followup, Save, and Copy subcommands and the
      outfolder	option.)

  Followup [message_list] (F)
      Responds to the first message in message_list, sending the message to
      the author of each message in message_list.  The subject line is taken
      from the first message and the response is recorded in a file whose
      name is derived from the author of the first message.  (See also the
      followup,	Save, and Copy commands	and the	outfolder option.)

  from [message_list] (f)
      Displays the headers of messages in message_list.

  group	(g)
      Identical	to the alias subcommand.

  headers [message_list] (h)
      Lists the	headers	in the current group of	messages (each group of	mes-
      sages contains 20	messages by default; change this with the set screen=
      statement). If the mailbox contains more messages	than can be displayed
      on the screen at one time, information about only	the first group	of
      messages is displayed.  To see information about the rest	of the mes-
      sages, use the h subcommand with a message number	that is	in the next
      range of messages, or use	the z subcommand to change the current mes-
      sage group.

  help
      Displays a brief summary of mailbox subcommands.	Identical to the ?
      (question	mark) subcommand.

  hold [message_list] (ho)
      Marks each message in message_list to be saved in	your system mailbox
      (/var/spool/mail/user) instead of	in $HOME/mbox.	Does not override the
      delete subcommand. Identical to the preserve subcommand.

  if condition (i)

  else (el)

  endif	(en)
      Construction for conditional execution of	mailx subcommands.  Subcom-
      mands following if are executed if condition is TRUE.  Subcommands fol-
      lowing else are executed if condition is not TRUE.  The else is not
      required.	The endif subcommand ends the construction and is required.
      The condition can	be receive (receiving mail) or send (sending mail).

  ignore [field_list] (ig)
      Adds the header fields in	field_list to the list of fields to be
      ignored.	Ignored	fields are not displayed when you look at a message
      with the type or print subcommands. Use this subcommand to suppress
      machine-generated	header fields.	Use the	Type and Print subcommands to
      print a message in its entirety, including ignored fields.  If ignore
      is executed with no arguments, it	lists the current set of ignored
      fields. Identical	to the discard subcommand.

  list (l)
      Displays a list of valid mailx subcommands.

  local
      Lists other names	for the	local host.

  mail address_list (m)
      Activates	the mail editor	to allow you to	create and send	a message to
      people specified in address_list.	The newly created message is indepen-
      dent from	any received messages.

  mbox [message_list] (mb)
      Indicates	that the messages in message_list be sent to your personal
      mailbox when you quit.  This operation is	the default action for mes-
      sages that you have looked at if you are looking at your system mailbox
      and the hold option is not set.

  more [message_list] (mo)
      Displays the messages inmessage_list using the defined pager program to
      control the display to the screen. Identical to the page subcommand.

  More [message_list] (Mo)
      Like more, but also displays ignored header fields.  (See	more and
      ignore.)

  new [message_list]
      Marks each message in message_list as not	having been read. Identical
      to the New, unread, and Unread subcommands.

  New [message_list]
      Marks each message in message_list as not	having been read. Identical
      to the new, unread, and Unread subcommands.

  next [message] (n)
      Makes the	next message in	the mailbox the	current	message, and displays
      that message. With an argument list, it displays the next	matching mes-
      sage.

  page [message_list] (pa)
      Displays the messages in message_list using the defined pager program
      to control the display to	the screen. Identical to the more subcommand.

  Page [message_list] (Pa)
      Like the page subcommand,	but also displays ignored header fields.
      Identical	to the More subcommand.

  pipe [message_list] [shell_command] (pi)

  | [message_list] [shell_command]
      Pipes the	message	through	shell_command.	The message is treated as if
      it were read.  If	no arguments are given,	the current message is piped
      through the command specified by the value of the	cmd option.  If	the
      page option is set, a formfeed character is inserted after each mes-
      sage.

  preserve (pre)
      Identical	to the hold subcommand.

  print	[message_list] (p)
      Displays the messages in message_list. Identical to the type subcom-
      mand, or simply pressing the <&lt;Return>&gt; key	with no	argument.

  Print	[message_list] (P)
      Like print, but also displays ignored header fields.  (See print and
      ignore.) Identical to the	Type subcommand.

  quit (q)
      Ends the session and returns to the shell.  All messages that were not
      deleted or saved are stored in your personal mailbox ($HOME/mbox).  All
      messages marked with hold	or preserve and	those messages that you	did
      not look at are saved in the system mailbox (/var/spool/mail/user). If
      the quit subcommand is given while editing a mailbox file	with the -f
      option, then the edit file is saved with the changes.  If	the edit file
      cannot be	saved, mailx does not exit.  Use the exit subcommand to	exit
      without saving the changes.

  reply	[message] (r)
      Allows you to reply to the sender	of message and to all others who
      received copies of message. Identical to the respond subcommand.

  Reply	[message] (R)
      Allows you to reply only to the sender of	message. Identical to the
      Respond subcommand.

  respond [message]
      Allows you to reply to the sender	of message and to all others who
      received copies of message. Identical to the reply subcommand.

  Respond [message]
      Allows you to reply only to the sender of	message. Identical to the
      Reply subcommand.

  retain [field_list]
      Adds the header fields in	field_list to the list of fields to be
      retained.	 Retained fields are displayed when you	look at	a message
      with the type or print subcommands. Use this subcommand to define	which
      header fields you	want displayed.	 Use the Type and Print	subcommands
      to print a message in its	entirety, including fields that	are not
      retained.	 If retain is executed with no arguments, it lists the
      current set of retained fields.

  save [message_list] file (s)
      Saves message_list, including header information,	to file	(or to a
      folder). If file already exists, message_list is appended	to file.
      Displays the filename and	the size of the	file when the operation	is
      complete.	If you save a message to a file, that message is not returned
      to the system mailbox nor	saved in your personal mailbox when you	quit
      the mailx	command. If a filename is not specified, the mailx command
      saves the	messages in your personal mailbox.

  Save [message_list] (S)
      Saves the	specified messages in a	file whose name	is derived from	the
      author of	the first message.  The	name of	the file is taken to be	the
      author's name with all network addressing	stripped off.  (See also the
      Copy, followup, and Followup subcommands,	and the	outfolder option.)

  set [option_list | option=value] (se)
      Displays the options that	are currently enabled. If arguments are
      specified, sets options in option_list (a	list of	binary options,	those
      that are either set or not set); or sets an option that must be
      assigned a value.	(See Enabling and Disabling Options for	a description
      of valid options.)

  shell	(sh)
      Invokes an interactive version of	the shell.

  size [message_list] (si)
      Displays the sizes in lines and characters of the	messages in
      message_list.

  source file (so)
      Reads and	executes the mailx commands from file.

  top [message_list] (to)
      Displays the top few lines of the	messages specified by message_list.
      The number of lines displayed is determined by the valued	option top-
      lines and	defaults to 5.

  touch	[message_list] (tou)
      Marks the	messages in message_list to be moved from your system mailbox
      to your personal mailbox when you	quit the mailx command,	even though
      you have not read	the listed messages.  The messages appear in your
      personal mailbox as unread messages. When	you use	touch, the last	mes-
      sage in message_list becomes the current message.

  type [message_list] (t)
      Displays the messages in message_list. Identical to the print subcom-
      mand.

  Type [message_list] (T)
      Like type, but also displays ignored header fields.  (See	type and
      ignore.) Identical to the	Print subcommand.

  unalias alias_list
      Deletes the specified alias names.  If a specified alias does not
      exist, the results are unspecified.

  undelete [message_list] (u)
      Removes the messages in message_list from	the list of messages to	be
      deleted when you quit mailx.  Without a message_list, undelete recalls
      the last deleted message.

  unread [message_list]	(U)
      Marks each message in message_list as not	having been read. Identical
      to the new, New, and Unread subcommands.

  Unread [message_list]
      Marks each message in message_list as not	having been read. Identical
      to the new, New, and unread subcommands.

  unset	[option_list] (uns)
      Discards the values of the options specified in option_list.  This
      action is	the inverse of the set subcommand.

  version (ve)
      Displays the version banner for the mailx	command.

  visual [message_list]	(v)
      Invokes the visual editor	and loads message_list into the	editor.	(This
      editor can be defined with the set VISUAL= statement.) When you exit
      the editor, any changes made during the editing session are saved	back
      to the messages in message_list.

  write	[message_list] file (w)
      Appends the messages specified in	message_list to	file.  Displays	the
      filename and the size of the file	when the operation is complete.	 Does
      not include message headers in the file.

  xit (x)
      Identical	to the exit subcommand.

  z [+]	[-]
      Changes the current message group	(group of 20 messages) and displays
      the headers of the messages in that group. If a +	or no argument is
      given, then headers in the next group are	shown.	If a - argument	is
      given, the headers in the	previous group are shown.

  Sending Mail


  You can use the mailx	command	in one of two ways to send information.	You
  can use the mailx command's built-in editor to both compose and send a
  short	message.  You can also use the mailx command to	send any text file to
  another user.	 The file can be a letter you have written using your favor-
  ite editor, a	source file for	a program you have written, or any other file
  in text format.

  The mailx command provides a line-oriented editor for	composing messages.
  This editor allows you to enter each line of the message and then press
  <&lt;Return>&gt; to get a new	line to	enter more text.  You cannot change the	text
  after	you press <&lt;Return>&gt;.  However, before you press <&lt;Return>&gt;, you can
  change text on the current line by using <&lt;Backspace>&gt; and <&lt;Delete>&gt; to erase
  the text and then enter the replacement text.	 Although you cannot change
  text on a line once you have pressed <&lt;Return>&gt;, you can change	the contents
  of your message before sending it by using the visual	or edit	subcommand to
  edit the message.

  By default, mailx treats lines beginning with	the ~ (tilde) character	as
  special while	you are	composing a message.  For instance, entering ~m	on a
  line by itself places	a copy of the current message into the response,
  shifting it to the right by one tab stop.

  Other	escapes	set up subject fields, add and delete recipients of the	mes-
  sage,	and allow you to escape	to an editor to	revise the message, or to a
  shell	to run other commands.	You can	change the Escape character to some-
  thing	other than a tilde with	the set	escape=	statement.  To view a summary
  of many useful commands, enter ~? on a line by itself	while in the mail
  editor.

  The following	list provides a	summary	of the mail editor commands.  Use
  these	commands only while in the mail	editor.	 The editor recognizes com-
  mands	only if	you enter them at the beginning	of a new line.

  ~:/~-
      Escapes to command mode.

  ~?  Displays a summary of the	mailx subcommands.

  ~!command
      Executes the shell command and returns to	the message.

  ~.  Simulates	End-of-File (terminates	message	input).

  ~:command

  ~_command
      Performs the command-level request.  Valid only when sending a message
      while reading mail.

  ~a  Inserts the autograph string from	the sign= option into the message.

  ~A  Inserts the autograph string from	the Sign= option into the message.

  ~b address_list
      Adds names in address_list to the	list of	people to receive blind
      copies of	the message. Can only be used to add to	(not to	change or
      delete) the contents of the Bcc: list.

  ~c address_list
      Adds names in address_list to the	list of	people to receive copies of
      the message. Can only be used to add to (not to change or	delete)	the
      contents of the Cc: list.

  ~C  Dumps core.

  ~d  Appends the file dead.letter from	your home directory to the current
      end of the message.

  ~e  Invokes the alternate editor using the text of the current message as
      input.  (This editor can be defined with the set EDITOR= statement.)
      When you exit that editor, you return to the mail	editor,	where you can
      continue appending text to the message, or you can send the message by
      quitting the mailx command.

  ~f message_list
      Includes one or more additional messages in the current message to for-
      ward to another user.  This subcommand reads each	message	in
      message_list and appends it to the end of	the current message, but it
      does not indent the appended messages. This subcommand is	also used to
      append messages for reference when the margins are too wide to imbed
      with the ~m subcommand.  The ~f subcommand works only if you entered
      the mail editor from the mailbox prompt using the	mail subcommand, the
      reply subcommand,	or the Reply subcommand.

  ~F message_list
      Performs the same	operation as the ~f command escape, except that	all
      headers are included in the message, regardless of previous discard,
      ignore, and retain commands.

  ~h  Allows you to add	or to change information in all	of the header fields.
      The system displays each of the four header fields, one at a time.  You
      can view the contents of each field and delete or	add information	to
      that field.  Press <&lt;Return>&gt; to save any changes to that field and	to
      display the next field and its contents.

  ~i string
      Inserts the value	of the named option into the text of the message.
      For example, ~A is equivalent to ~i Sign.

  ~m message_list
      Reads message_list into the current messagefor reference purposes. This
      subcommand reads each message in message_list and	appends	it to the
      current message.	The included message is	indented one tab character
      from the normal left margin of the message.  This	subcommand works only
      if you entered the mail editor from the mailbox prompt using the mail
      subcommand, the reply subcommand,	or the Reply subcommand.  If no	mes-
      sages are	specified, it reads the	current	message.

  ~M message_list
      Performs the same	operation as the ~m command escape, except that	all
      headers are included in the message, regardless of previous discard,
      ignore, and retain commands.

  ~p  Displays the message as it currently exists, prefaced by the message
      header fields.

  ~q or	~Q
      Quits the	editor,	aborting the message being created without sending
      it. Saves	the message in the dead.letter file in your home directory,
      unless the nosave	option is set. The previous contents of	the
      dead.letter file are overwritten by the partially	completed message.

      You can also quit	the editor by using the	Interrupt key sequence.

  ~<&lt;file

  ~<&lt;!shell_command

  ~r file
      Reads the	named file into	the message.  If the argument begins with !,
      the rest of the string is	taken as an arbitrary system command and is
      executed,	with the standard output inserted into the message.

  ~s string
      Changes the Subject: field to the	phrase specified in string.

  ~t address_list
      Adds the addresses in address_list to the	To: field of the message. Can
      only be used to add to (not to change or delete) the contents of the
      To: list.

  ~v  Invokes the visual editor	using the text of the current message as the
      input file.  (This editor	can be defined using the set VISUAL= state-
      ment.) When you exit that	editor,	you return to the mail editor, where
      you can continue appending text to the message, or you can send the
      message by quitting the mailx command.

  ~w file
      Writes the message to the	named file.

  ~x  Exits as with ~q,	except the message is not saved	in dead.letter.

  ~|command or ~^command
      Pipes the	message	through	command	as a filter. If	command	gives no out-
      put or terminates	abnormally, it retains the original text of the	mes-
      sage.  Otherwise,	the output of command replaces the current message.
      The fmt command is often used as command to format the message.

  ~~  Allows you to use	the ~ (tilde) character	in a message without it	being
      interpreted as a command prefix.	The sequence ~~	(two tildes) results
      in only one ~ being sent in the message.

  Customizing the Mail Program


  The system manager uses the /usr/share/lib/Mail.rc file to define the	ini-
  tial configuration for the mailx command.  The subcommands in	this file
  override the default characteristics of the mailx command for	all users on
  the system.  Although	the initial configuration can meet the needs of	most
  users, you can alter it by creating the $HOME/.mailrc	file.  Subcommands in
  this file override similar subcommands in /usr/share/lib/Mail.rc when	you
  run the mailx	command.  The following	subcommands are	not legal in the
  start-up file: !, Copy, edit,	followup, Followup, hold, mail,	preserve,
  reply, Reply,	shell, and visual.

  There	are four mail subcommands that are most	commonly used to alter the
  characteristics of the mailx session:	set, unset, alias, and ignore.	The
  set and unset	subcommands enable and disable mail options, the alias
  subcommand shortens how you address mail, and	the ignore subcommand
  suppresses message header fields.





  Enabling and Disabling Options


  The following	are environment	variables taken	from the execution environ-
  ment and are not alterable within mailx:

  EXCODE=Locale
      The name of the locale for performing character conversions on outgoing
      messages.

  HOME=directory
      The pathname of the user's home directory.

  LANG=Locale
      The name of the locale for displaying mail messages.

  MAILRC=file
      The name of the start-up file.  The default is $HOME/.mailrc.

  Use the set subcommand to enable options and the unset subcommand to dis-
  able options.	 Options can be	either binary or valued. Binary	options	are
  either set or	unset, while valued options can	be set to a specific value.
  You can set options by placing set subcommand	lines in your $HOME/.mailrc
  file.

  The syntax for enabling options using	the set	subcommand is as follows:

  set [option_list | option=value]

  The syntax for disabling options using the unset subcommand is as follows:

  unset	[option_list]

  The following	is a list of binary options (those that	can be set or unset):

  allnet
      Off by default; all network names	with the same login name are treated
      as being the same.

  append
      Causes messages saved in mbox to be appended (added to the end) rather
      than prepended (added to the beginning).

  ask Causes mailx to prompt you for the subject of each message you send.
      If you respond with a newline (carriage return), no subject field	is
      set.  This option	is enabled by default.

  askbcc
      Causes mailx to prompt you for the address of people to receive blind
      carbon copies of the message.  Responding	with a newline indicates
      satisfaction with	the current list.  The default is noaskbcc.

  askcc
      Causes you to be prompted	for the	addresses of people to receive copies
      of the message. Responding with a	newline	indicates your satisfaction
      with the current list.

  asksub
      Prompts for subject if it	is not specified on the	command	line with the
      -s option.  Identical to ask.

  autoprint
      Causes the delete	subcommand to behave like dp. Thus, after deleting a
      message, the next	one is typed automatically.

  bang
      Enables the special-case treatment of ! (exclamation points) in escape
      command lines as in vi.  The default is nobang.

  debug
      Causes mailx to display debugging	information.  The mailx	command	does
      not send mail while in debug mode. Same as specifying -d on the command
      line.

  dot Causes mailx to interpret	a period alone on a line as the	terminator of
      a	message	you are	sending.

  flipr
      Reverses the meaning of the R and	r commands.  The default is noflipr.

  header
      Enables printing of the header summary when entering mailx. This option
      is enabled by default.

  hold
      Holds messages in	the system mailbox by default.

  ignore
      Causes Interrupt signals from your terminal to be	ignored	and echoed as
      @'s.

  ignoreeof
      Makes mailx refuse to accept End-of-File key sequence as the end of a
      message or as the	quit subcommand. Related to the	dot subcommand.

  keep
      Truncates	the mailbox to zero length when	it is empty, instead of
      removing it.  This option	is disabled by default.

  keepsave
      Keeps messages that have been saved in other files in the	mailbox,
      instead of deleting them.	 The default is	nokeepsave.

  metoo
      Causes the sender	to be included in the alias expansion, and thus
      receives copies of messages.  Usually, when an alias containing the
      sender is	expanded, the sender is	removed	from the expansion.

  onehop
      Used when	replying to a message sent to several users and	prevents the
      addresses	of the recipients from being made relative to the address of
      the original author.  You	can use	this variable only on a	network	where
      all systems can connect to one another directly.

  nosave
      Prevents mailx from copying the partial letter to	the file dead.letter
      in your home directory when a message is terminated with two Interrupt
      key sequences.

  outfolder
      Causes the files used to record outgoing messages	to be located in the
      directory	specified by the folder	option unless the pathname is abso-
      lute.  The default is nooutfolder.  (See the folder option and the
      Save, Copy, followup, and	Followup subcommands.)

  page
      Inserts a	formfeed after each message sent through the pipe when used
      with the pipe command.  The default is nopage.

  quiet
      Suppresses the printing of the program banner when mailx starts. (The
      banner is	the line that shows the	name of	the mail program.)

  Replyall
      Reverses the sense of the	reply and Reply	mailbox	subcommands.

  save
      Enables saving of	messages in dead.letter	on interrupt or	delivery
      error.  (See DEAD= for a description of this file.  This option is
      enabled by default.)

  sendwait
      Waits for	the background mailer to finish	before returning.  The
      default is nosendwait.

  showto
      Prints the recipient's name instead of the author's name when display-
      ing the header summary and the message is	from the user.

  verbose
      Runs mailx in verbose mode; the actual delivery of messages is
      displayed	on the user's terminal.	Same as	using the -v option on the
      command line.

  The following	is a list of valued options (those that	can be assigned	a
  value). The syntax for assigning values is set option=value.

  cmd=shell_command
      Sets the default command for the pipe subcommand.	 There is no default
      value.

  conv=conversion
      Off by default; used to convert uucp addresses for sendmail.

  crt=number
      Causes the paging	program	to automatically be invoked for	messages that
      exceed number lines.

  DEAD=file
      Specifies	the name of the	file in	which to save partial letters in case
      of untimely interrupt or delivery	errors.	 The default is
      $HOME/dead.letter.

  EDITOR=pathname
      Defines the text editor invoked by the ~e	and edit subcommands.  The
      absolute pathname	must be	given.	The default editor is /usr/bin/ex.

  escape=character
      Defines a	character to use in the	place of ~ (tilde) to denote escapes.

  excode=Locale
      Sets the locale for performing character conversion on outgoing mes-
      sages.  The default is None.

  folder=pathname
      Defines the name of the directory	to use for storing folders of mes-
      sages.  If this name begins with a / (slash), mailx considers it to be
      an absolute pathname; otherwise, the folder directory is found relative
      to your home directory.

  indentprefix=string
      Specifies	a string that is prefixed to each line inserted	into the mes-
      sage by the ~m command escape.  The default string is one	<&lt;Tab>&gt; charac-
      ter.

  lang=Locale
      Sets the locale for displaying mail messages. The	default	is C.

  LISTER=shell_command
      Specifies	the command (and arguments) to use when	listing	the contents
      of the folder directory.	The default is ls.

  MAILBOX=file
      Specifies	the name of the	system mailbox,	by default
      /var/spool/mail/username.

  MBOX=file
      Specifies	the name of the	file in	which to save messages that have been
      read. The	exit subcommand	overrides this function, as does saving	the
      message explicitly in another file.  The default is $HOME/mbox.

  PAGER=pathname
      Specifies	the pathname of	the paging program to use for the more sub-
      command or when the crt option is	set.  If you do	not specify a value
      for PAGER, the system uses /usr/bin/pg.

  prompt=string
      Sets the command mode prompt to string.  The default is ?.

  record=pathname
      Specifies	the pathname of	the file (relative to $HOME) used to record
      all outgoing mail. A copy	of all the messages you	send out is saved in
      this file.  Review this file periodically	and delete all unnecessary
      messages.

      The mailx	subcommands do not create directories, so any directories
      included in the pathname must already exist before using this subcom-
      mand.  Do	not include the	home directory as part of the pathname.	If
      record is	not defined, then copies of outgoing mail are not saved.

  screen=number
      Controls how many	lines of the message list are displayed	at a time.
      You can set this option to show a	certain	number of lines	on the
      screen.  Each message in your mailbox has	a one-line header in the mes-
      sage list. If you	have more than 24 messages, the	first headers from
      the message list scroll past the top of your screen whenever you
      display the list.

  sendmail=shell_command
      Specifies	an alternative command for delivering mail.

  SHELL=pathname
      Specifies	the pathname of	the shell to use in the	! and ~! subcommands.
      If this option is	not defined, your default shell	is used.

  sign=string
      Specifies	the variable inserted into the text of a message when the ~a
      (autograph) subcommand is	given.	(See also the ~i tilde escape.)
      There is no default value.

  Sign=string
      Specifies	the variable inserted into the text of a message when the ~A
      subcommand is given.  (See also the ~i tilde escape.)  There is no
      default value.

  toplines=number
      Specifies	the number of lines of a message to be displayed with the top
      subcommand; normally, the	first five lines are displayed.

  VISUAL=pathname
      Specifies	the pathname of	the text editor	to use in the visual and ~v
      subcommands.  The	default	pathname is /usr/bin/vi.


  Creating Aliases and Distribution Lists


  If you send mail on a	large network or often send the	same message to	a
  large	number of people, entering long	addresses for each receiver can
  become tedious.  To simplify this process, you can create an alias or	a
  distribution list in your $HOME/.mailrc file.

  An alias is a	name you define	that can be used in place of a user address
  when you address mail.  A distribution list is a name	that you define	that
  can be used in place of a group of user addresses when you address mail.

  Aliases and distribution lists are used the same way and defined in similar
  ways;	the only difference is the number of addresses defined for an alias
  (one address)	and a distribution list	(more than one address).

  Changing the Information at the Top of a Message


  You can use the ignore subcommand to suppress	message	header fields that
  are normally displayed when you read a message using the type	or print sub-
  commands.  The four message header fields are	To, Subject, Cc, and Bcc.

  The syntax of	the ignore subcommand is as follows:

  ignore [field_list]

  Note that fields are specified without a trailing : (colon). You can
  include the fields you want to ignore	in your	$HOME/.mailrc file.

  Internationalization


  [Tru64 UNIX]	 The mailx command supports codeset conversion of mail mes-
  sages	between	the mail interchange code (specified by	the EXCODE environ-
  ment variable) used to transmit messages to other hosts and the application
  code (specified by the LANG environment variable) used by the	user.  For
  example, if the mail interchange code	is ISO-2022-JP and the application
  code is eucJP, the mailx program converts incoming messages from ISO-2022-
  JP to	the Japanese EUC character set when displaying them and	converts out-
  going	mail message from the Japanese EUC character set to ISO-2022-JP.

  To prevent data loss,	incoming mail messages are stored in the mail folders
  as received, without conversion.  The	conversion takes place when you
  display or extract mail messages.

  To encode the	mail interchange code information, new header lines are	added
  to the outgoing mail messages. For example, if the mail interchange code is
  ISO-2022-JP, the following additional	header lines are added:

       Mime-Version: 1.0
       Content-Type: TEXT/PLAIN; charset=ISO-2022-JP

  The charset field of the Content-Type	header line provides the mail inter-
  change code information.  For	non-ISO	codesets, the prefix X-	is added to
  the character	set name for identification purposes. For example:

       Mime-Version: 1.0
       Content-Type: TEXT/PLAIN; charset=X-eucJP

  For incoming mail messages, the mail interchange to be used is determined
  by the charset field of the additional header	lines, if present.

  For outgoing mail messages, the following rules determine the	mail inter-
  change code to be used:

   1.  The EXCODE environment variable.

   2.  The excode valued option	defined	in $HOME/.mailrc or
       /usr/share/lib/Mail.rc

  The application code is determined from the codeset part of the following
  locale information:

   1.  The LANG	environment variable.

   2.  The lang	valued option defined in $HOME/.mailrc or
       /usr/share/lib/Mail.rc

   3.  Defaults	to C.

  Note that you	must specify a mail interchange	code to	do character conver-
  sion.	 There are no defaults.

  All messages associated with conversion are informational only.  The mail
  messages in question are still delivered or received.

  The excode and lang options are recognized only within $HOME/.mailrc or
  /usr/share/lib/Mail.rc.  Setting these options within	mailx has no effect.

RESTRICTIONS

  The mailx command uses only mailbox files.  It does not use POP or IMAP
  mailboxes.

EXAMPLES

   1.  To save a message to a folder, enter the	following at the mailbox
       prompt (?):
	    save 1 +procedures

       The following message is	displayed:
	    /u/jay/doc/procedures [Appended] 32/947

       In this example,	message	1 was added to the end of the folder pro-
       cedures.	 User jay has the following set	folder statement in his
       $HOME/.mailrc file so that the folder directory where that folder is
       kept is already selected:


	    set	folder=/u/jay/doc

   2.  To look at the contents of a specific mail folder, enter	the following
       at the command-line prompt:
	    mailx -f +dept

       In this example,	a listing of the messages in the dept folder is
       displayed.

   3.  To prevent the Date, From, and To headers from being displayed when a
       message is read with the	type or	the print subcommand, enter the	fol-
       lowing statement	in your	$HOME/.mailrc file:
	    ignore date	from to

       When a message is displayed using the type or print subcommand, the
       date, from, and to headers are not displayed.  However, if you want to
       display these headers without deleting the ignore statement from	your
       $HOME/.mailrc file, use the Type, Print,	or top subcommands to display
       the message.

   4.  To keep a record	of messages you	send to	others,	enter the following
       statement in your $HOME/.mailrc file:
	    set	record=letters/mailout

   5.  To create a distribution	list for your department, enter	the following
       statement in your $HOME/.mailrc file:
	    alias dept dee@merlin anne@anchor jerry@zeus bill carl

       To send a message to your department after you have added this line to
       your $HOME/.mailrc file,	enter the following at the command line
       prompt:
	    mailx dept

       The message you now create and send will	go to dee on system merlin,
       anne on system anchor, jerry on system zeus, and	to bill	and carl on
       the local system.

FILES

  /var/spool/mail/*
      User mailbox files.

  $HOME/mbox
      Holds saved mail.

  $HOME/.mailrc
      File containing mailx subcommands	to customize mailx for a specific
      user.

  /usr/share/lib/Mail.rc
      File containing mailx subcommands	to change mailx	for all	users on the
      system.

SEE ALSO

  Commands:  mail(1), fmt(1), pg(1), sendmail(8)

  Standards:  standards(5)