[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Commands Reference, Volume 3

mail, Mail, or mailx Command

Purpose

Sends and receives mail.

Syntax

To Read Incoming Mail

mail -e

mail -f [-dHNn][-F][FileName]

mail [-dHNn][-F][-u UserID]

To Send Mail

mail [-s Subject][-c Address(es)][-dinNv] Address

Description

The mail command invokes the mail utility, enabling you to:

In addition, you can use the available options and subcommands to customize the way you send and receive mail.

The mail command operates on two types of mailboxes, the system mailbox and the personal mailbox.

Incoming mail is stored in the system mailbox. By default, a user's system mailbox is a file located in the /var/spool/mail directory. The mailbox file is named after the userID. For example, if your userID is jeanne, then your system mailbox is /var/spool/mail/jeanne.

By default, when a user has read, deleted, or saved all the mail in their system mailbox, the mailbox is deleted. To prevent the mailbox from being deleted, use the set subcommand to set the keep option.

In addition to the system mailbox, there is the user's personal mailbox. As messages are read, if they are not deleted or saved to a file, they will be marked to be moved to the personal mailbox. The personal mailbox, by default, is $HOME/mbox. For example, if your home directory is /home/lance, then /home/lance/mbox is 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 with a name that pertains to the subject matter of the messages it contains.

Note: Results can be unpredictable when running multiple instances of the mail command on one mailbox.

Examining the Contents of Your Mailbox

To process your mail, enter mail at the system prompt. The Mail program displays a one-line entry for each piece of mail in your system mailbox:

Mail [5.2 UCB] [AIX 4.1] Type ? for help.
"/var/spool/mail/lance": 2 messages 2 new
>N 1 karen         Thu Sep 17 14:36 13/359 "Dept Meeting"
 N 2 lance@zeus    Thu Sep 17 15:06 10/350 "Delay"
 N 3 karen         Thu Sep 17 14:36 13/359 "Meeting Cancel"

The current message is marked by a > at the beginning of a line in the header summary.

Each one-line entry displays the following fields:

status Indicates the current class of a piece of mail. The status can be any of the following:
N A new message
P A message to be preserved in system mailbox.
U An unread message. An unread message is a message that was listed in the mailbox last time you invoked the Mail program, but whose contents you did not examine.
* A message that was saved or written to a file or folder.

A message without a status indicates that the message has been read but has not been deleted or saved.

number Identifies the numerical order of the message.
sender Identifies the address of the person who sent the mail.
date Specifies the date the message was received.
size Defines the number of lines and characters contained in the letter (this includes the header).
subject Identifies the subject of the message.

Finally, following the list of mail, the Mail program displays the mailbox prompt, which by default is ?, to indicate that it is waiting for input.

Flags

-c Address(es) Specifies the list of users to which a copy of the message is sent. You can specify one or more addresses. When specifying more than one address, the list of addresses must be in (" ") quotes.
-e Tests for the presence of mail in the system mailbox. The mail utility will write nothing and exit with a successful return code if there is mail to read.
-f FileName Reads messages from the named file. If a file operand is not specified, then reads messages from mbox. When you quit from reading the messages, undeleted messages are written back to this file.
-F Records the message in a file named after the recipient. The name is the portion of the address found first on the To: line in the mail header. Overrides the record variable if set.
-H Writes a header summary only.
-i Causes tty interrupt signals to be ignored.
-n Inhibits reading the /usr/share/lib/Mail.rc file.
-N Suppresses the initial printing of headers.
-s Subject Specifies a subject for a message to be created.
-u UserID Specifies an abbreviated equivalent of doing mail -f /var/spool/mail/UserID. Starts the Mail program for a specified user's mailbox. You must have access permission to the specified mailbox.
-v Puts the Mail program into verbose mode. Displays the details of delivery on the user's terminal.

Environmental Variables

The following environment variables affect the execution of mail:

DEAD Pathname of the file in which to save partial messages in case of interrupts or delivery errors.
EDITOR Pathname of the editor to use when the edit or ~e command is used.
HOME Pathname of the user's home directory.
LISTER String representing the command for writing the contents of the folder directory to standard output when the folders command is given. Any string acceptable as a command_string operand to the sh -c command is valid. If this variable is null or not set, the output command will be ls. The default value is unset.
MAILBOX Specifies the location of the system mailbox for the mail command. The MAILBOX value is where the mail command searches for mail messages. The system default value if the MAILBOX environment variable is not specified is the /var/spool/mail directory.
MAILRC Pathname of your personal startup file. The default is $HOME/.mailrc.
MBOX Pathname of your personal mailbox where messages are saved from the system mailbox that have been read. The exit command overrides this function, as will saving the message explicitly in another file. The default is $HOME/mbox.
PAGER String representing an output filtering or pagination command for writing the output to the terminal. Any string acceptable as a command_string operand to the sh-c command is valid. When standard output is a terminal device, the message output will be piped through the command if the mail internal variable crt is set to a value less the number of lines in the message. If the PAGER variable is null or not set, the paginator is the pg shell command.
SHELL Pathname of a preferred command interpreter.
VISUAL Pathname of a utility to invoke when the visual command or ~v command-escape is used. If this variable is not set, the full screen editor will be vi.

Internal Variables in Mail

allnet Treats all network names, whose login name components match, identically. Causes the msglist message specifications to behave similarly. The default is noallnet.
append Adds the message saved in your mailbox to the end, rather than the beginning, of the $HOME/mbox file. The default is noappend.
ask, asksub Prompts for the subject of each message if not specified on the command line with the -s option. If you do not wish to create a subject field, press enter at the prompt. It is not possible to set both ask and noasksub, or noask and asksub. The default is asksub.
askbcc Prompts for the addresses of people to add to the blind copy list. If you do not wish to send blind copies, press enter at the prompt.
askcc Prompts for the addresses of people who should receive copies of the message. If you do not wish to send copies, press enter at the prompt.
autoprint Sets the delete subcommand to delete the current message and display the next message.
crt Specifies the minimum number of lines which a message must consist of before any output filtering or pagination is used when the message is displayed.
debug Displays debugging information. Messages are not sent while in debug mode. This is the same as specifying the -d flag on the command line.
dot Interprets a period entered on a line by itself as the end of a message you are sending.
escape=c Sets the command escape character to be the character c. By default the command escape character is ~ (tilde).
Replyall, flipr Reverses the meanings of the Respond and respond or Reply and reply commands. The default is noflipr.
folder=directory The directory name in which to store mail folders. Once the directory is defined, you can use the + (plus sign) notation to refer to it when using the FileName parameter with mailbox subcommands.
header Enables writing of the header summary when entering mail in receive mode. The default is header.
hold Holds messages that you have read but have not deleted or saved in the system mailbox instead of in your personal mailbox. The default is nohold.
ignore Ignores interrupts while entering messages. Echoes interrupts as @ (at) characters.
ignoreeof Sets the mail command to refuse the Ctrl-D key sequence as the end of a message. Input can be terminated only by entering a period . (period) on a line by itself or by the ~. command escape. The default is noignoreeof.
indentprefix=string A string that will be prefixed to each line that is inserted into the message by the ~m command escape. This variable defaults to one tab character.
keep When a system mailbox, secondary mailbox, or mbox is empty, truncate it to zero length instead of removing it. The default is nokeep.
keepsave Keep messages that have been saved with the (s)ave or (w)rite subcommands in the system mailbox instead of deleting them. The default is nokeepsave.
metoo Includes the sender in the alias expansion if sender's name is part of the alias. By default, expanding the alias removes the sender.
onehop When responding to a message that was originally sent to several recipients, the other recipient addresses are normally forced to be relative to the originating author's machine for the response. This flag disables alteration of the recipient's addresses, improving efficiency in a network where all machines can send directly to all other machines (that is, one hop away). The default is noonehop.
outfolder Causes the files used to record outgoing messages to be located in the directory specified by the folder variable unless the pathname is absolute. The default is nooutfolder. See the record and folder variables.
page Insert a form-feed after each message sent through the pipe created by the pipe command. The default is nopage.
prompt=string Set the command-mode prompt to string. If string is null or if noprompt is set, no prompting will occur. The default is to prompt with the "?" string.
quiet Refrain from writing the opening message and version when entering mail. The default is noquiet.
record=file Defines a file in which to record all outgoing mail. The default is norecord.
save Enables saving of messages in the dead.letter file on interrupt or delivery error. The default is save.
screen=number Sets the number of lines in a screenful of headers for the headers and z commands.
sendmail=shell_command Alternative command for delivering messages.
sendwait Wait for the background mailer to finish before returning. The default is nosendwait.
showto When the sender of the message was the user who is invoking mail, write the information from the To: line instead of the From: line in the header summary. The default is noshowto.
sign=string Inserts string into the text of a message when the ~a command escape is given. The default is nosign. The character sequences /t and /n are recognized in the string as tab and newline characters, respectively.
Sign=string Inserts string into the text of a message when the ~A command escape is given. The default is noSign.
toplines=number Number of lines displayed by the top subcommand.
verbose Displays the actual delivery of messages on the terminal. This is the same as specifying the -v flag on the command line.

Setting Environment Variables

The Bourne shell (bsh command) uses and checks the following variables. These variables can be set in $HOME/.profile.

MAIL Specifies the location and name of the user's system mailbox that is checked by the Bourne shell to determine whether or not you have mail. If the system mailbox is not empty, the Bourne shell sends a message that you have new mail. The Bourne shell checks the system mailbox periodically based on the value of the MAILCHECK environment variable.
MAILCHECK Specifies the interval at which the Bourne shell checks the system mailbox for mail.
MAILMSG Specifies the message sent to your console shell by the system when you have mail. The default message is similar to the following:
YOU HAVE NEW MAIL

Examples

  1. To start the Mail program and list the messages in your mailbox, enter the following at the command line prompt:
    mail
    The mail command lists every messages in your system mailbox. The mail system then displays the mailbox prompt (?) to indicate waiting for input. When you see this prompt, enter any mailbox subcommand. To see a list of subcommands, enter:
    ?
    This entry lists the Mail subcommands.
  2. To send the message letter to the recipient user1@host1 and copies to user2@host2 and user3@host3 , enter:
    mail -c "user2@host2 user3@host3" user1@host1<letter
  3. To look at the contents of your personal mailbox, enter:
    mail -f
    This command displays a list of the messages in your personal mailbox, $HOME/mbox.
  4. To look at the contents of a specific mail folder, enter:
    mail -f +dept
    This command displays a listing of the messages in the dept folder.
  5. To send a message to a user on your local system, enter:
    mail ron
    When you finish entering the message to user ron , press the Enter key and press either . (period) or Ctrl-D to exit the editor and send the message. To determine if a user is on your local system, check for the user's name in your /etc/passwd file.

    If your message is delivered successfully, you receive no notification. If your message could not be delivered, an error message is sent to you.

  6. To mail a file to another user on your local system, enter:
    mail karen < letter1
    This command sends the contents of the file letter1  to user karen on your local system. After the command sends the file, the Mail program displays the command line prompt.
  7. To send a message to a user on a remote system, enter:
    mail dale@zeus
    You now can create a message to dale . In this example, you are sending a message to user dale  on remote system zeus . To send a message to a user on another system connected to your system through a network, you must know that person's login ID and the name of the other system.

Mailbox Subcommands for the mail, Mail, and mailx Command

From the mail prompt, ? (question mark), you can enter subcommands to manipulate mail in your mailbox. Subcommands that work on more than one message at a time use the MessageList parameter. Subcommands that work with files or folders use the FileName parameter. These parameters are discussed in "Summary of Mailbox Subcommands in the Mail Program" in AIX Version 4.3 System User's Guide: Communications and Networks.

The following list describes the Mailbox subcommands and their functions:

= Echoes the number of the current message.
# Comment character for writing comments in mail script files.
- Displays the previous message.
? Displays a brief summary of mailbox subcommands. Identical to the help subcommand.
!Command Executes the workstation shell command specified by Command.
alias (a) With no arguments, displays all currently defined aliases and their corresponding addresses. With one argument, displays one alias. With more than one argument, creates a new alias or changes an old alias. Identical to the group subcommand.
alternates AlternatesList (alt) The alternates subcommand is useful if you have accounts on several machines. Use the subcommand to inform the Mail program that the addresses listed in AlternatesList all refer to you. When you use the reply subcommand to reply to messages, the Mail program does not send a copy of the message to any of the addresses given in AlternatesList. If you enter the alternates subcommand with no argument, the Mail program displays the current set of alternate names.
chdir Directory (cd) Changes your working directory to the indicated Directory. If no directory is given, it changes to your login directory.
copy [MessageList] File (c, co) Appends each message in MessageList to the end of File. Displays the file name in quotes, followed by the line count and character count, on the user's terminal. Does not delete any messages when you quit.
Copy [MessageList] (C) Saves the specified message in a file whose name is derived from the author of the message to be saved, without marking the messages as saved. Otherwise, it is equivalent to the Save subcommand.
delete [MessageList] (d) Marks the messages in MessageList to be deleted when you quit the Mail program. Entering the d subcommand without a message list deletes the current message. Deleted messages are not saved in your $HOME/mbox file nor are they available for most other commands. However, you can use the undelete subcommand to restore messages you have deleted while in the same mailbox session. 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 [FieldList] (di) Identical to the ignore subcommand.
Note: The retain subcommand overrides the discard subcommand.
dp Deletes the current message and displays the next message. If there is no next message, the Mail program displays EOF . Identical to the dt subcommand.
dt Deletes the current message and displays the next message. If there is no next message, the Mail program displays EOF . Identical to the dp subcommand.
echo String Displays the character string String on the command line.
edit [MessageList] (e) Starts the alternate editor using the MessageList as input files. To define an alternate editor, use the set EDITOR= statement or place an entry in your $HOME/.mailrc file. Any message specified by the MessageList parameter retains the changes made during the editor session.
exit (ex or x) Leaves the mailbox and returns to the operating system without changing the original contents of the mailbox. The mailbox returns to the condition that it was when the Mail program 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] (fo) Switches to a new mail file or folder. With no arguments, the subcommand displays the name of the current mailbox. 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 parameter. 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/UserID).
& Refers to your personal mailbox ($HOME/mbox).
+ Name Refers to a file in your folder directory.
folders Lists the names of the folders in your folder directory.
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 variable, if set.
Followup [MessageList] (F) Responds to the first message in the msglist, sending the message to the author of each message in the msglist. 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.
from [MessageList] (f) Displays the headings of messages in MessageList.
group (g) Identical to the alias subcommand.
headers [Message] (h) Lists the headings in the current group of messages (each group of messages 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 will be displayed. To see information about the rest of the messages, use the h subcommand with a message number in the next range of messages, or use the z subcommand to change the current message group.
help Displays a brief summary of mailbox subcommands. Identical to the ? subcommand.
hold [MessageList] (ho) Marks each message in MessageList to be saved in your system mailbox (/var/spool/mail/UserID) instead of in your $HOME/mbox file. Does not override the delete subcommand. Identical to the preserve subcommand.
if Condition
else
endif Construction for conditional execution of the mail subcommands. Subcommands following if are executed if Condition is true. Subcommands following else are executed if Condition is not true. The else is not required. The endif ends the construction and is required. The Condition can be receive (receiving mail) or send (sending mail).
ignore [FieldList] Adds the header fields in FieldList to the list of fields to be ignored. Ignored fields are not displayed when you look at a message with either the type or print subcommand. Use this subcommand to suppress machine-generated header fields. Use either the Type or Print subcommand to print a message in its entirety, including ignored fields. The ignore subcommand with no arguments lists all header fields that are not included when you use a type or print subcommand to display a message. Identical to the discard subcommand.
list (l) Displays a list of all mailbox subcommands with no explanation of what they do.
mail AddressList (m) Starts the mail editor. Enables you to create and send a message to people specified in AddressList. The newly created message is independent from any receive messages.
mbox [MessageList] Indicates that the messages in MessageList are to be sent to your personal mailbox ($HOME/mbox) when you quit the Mail program. This operation is the default action for messages that you have read if you are looking at your system mailbox (/var/spool/mail/UserID) and the hold option is not set.
more [MessageList] (mo) Displays the messages in MessageList using the defined pager program to control display to the screen. Identical to the page subcommand.
More [MessageList] (Mo) Similar to the more subcommand, but also displays ignored header fields.
new [MessageList] Marks each message in MessageList as not having been read. Identical to the New, unread, and Unread subcommands.
New [MessageList] Marks each message in MessageList 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 message.
page [MessageList] (pa) Displays the messages in MessageList using the defined pager program to control display to the screen. Identical to the more subcommand.
Page [MessageList] (Pa) Similar to the page subcommand but also displays ignored header fields.

pipe [[msglist command]]

| [[msglist] command]] (pi) Pipe the messages through the given command by invoking the command interpreter specified by SHELL with two arguments: -c and command. The command must be given as a single argument. This can be accomplished by quoting. If no arguments are given, the current message will be piped through the command specified by the value of the cmd variable. If the page variable is set, a form-feed character will be inserted after each message.
preserve (pre) Identical to the hold subcommand.
print [MessageList] (p) Displays the text of a specific message. Identical to the type subcommand.
Print [MessageList] (P) Displays the text of a specific message along with the ignored header fields. Identical to the Type subcommand.
quit (q) Leaves the mailbox and returns to the operating system. All messages read, but not deleted or saved are stored in your personal mailbox ($HOME/mbox). All messages you have marked to be deleted are removed from the mailbox and cannot be recovered. All messages marked with the hold or preserve option and messages you have not viewed are saved in the system mailbox (/var/spool/mail/UserID). If the quit subcommand is given while editing a mailbox file with the -f flag, the edit file is saved with changes. If the edit file cannot be saved, the Mail program does not exit. Use the exit subcommand to exit without saving the changes.
reply [Message] (r) Allows you to reply to the sender of a message and to all others who receive copies of the message. Identical to the respond subcommand.
Reply [Message] (R) Allows you to reply to only the sender of a message. Identical to the Respond subcommand.
respond [Message] Allows you to reply to the sender of a message and to all others who receive copies of a message. Identical to the reply subcommand.
Respond [Message] Allows you to reply to only the sender of a message. Identical to the Reply subcommand.
retain [FieldList] Adds the header fields in FieldList to the list of fields to be retained. Retained fields are displayed when you look at a message with the type subcommand or print subcommand. Use this subcommand to define which header fields you want displayed. Use the Type or Print subcommand to print a message in its entirety, including fields that are not retained. If the retain subcommand is executed with no arguments, it lists the current set of retained fields.
Note: The retain subcommand overrides the discard subcommand.
save [ File ] (s) Saves the current message including header information to a file or folder. If the file already exists, the message is appended to the file. If File is ommitted, the message will be saved to the user's mbox.
save [MessageList] File (s) Saves a MessageList including heading information to a file or folder. If the file already exists, the MessageList is appended to the file. Displays the file name 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 (/var/spool/mail/UserID) nor saved in your personal mailbox ($HOME/mbox) when you quit the Mail program.
Save [MessageList] (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.
set [OptionList | Option=Value...]
                          (se) With no arguments, displays the options that are currently enabled. Otherwise, sets an option as specified. The argument following the set command can be either:

The options are listed in the .mailrc file format.

Note: The form unset name is equivalent to noname.
shell (sh) Starts an interactive version of the shell.
size [MessageList] Displays the sizes in lines/characters of the messages in MessageList.
source File (so) Reads and executes the mail subcommands from File.
top [MessageList] Displays the top few lines of the messages specified by MessageList. The number of lines displayed is determined by the valued option toplines and defaults to five.
touch [MessageList] Within your system mailbox (/var/spool/mail/UserID), this subcommand marks the messages in MessageList to be moved to your personal mailbox ($HOME/mbox) when you quit the Mail program. The messages are moved even though you have not read them. The messages are displayed in your personal mailbox as unread messages. The last message in MessageList becomes the current message.
type [MessageList] (t) Displays the text of a specific message. Identical to the print subcommand.
Type [MessageList] (T) Displays the text of a specific message along with the ignored header fields. Identical to the Print subcommand.
unalias Deletes the specified alias names.
undelete [MessageList] (u) Removes the messages in MessageList from the list of messages to be deleted when you quit the Mail program. Entering the u subcommand without a message list recalls the last deleted message.
unread [MessageList] (U) Marks each message in MessageList as not having been read. Identical to the new, New, and Unread subcommands.
Unread [MessageList] Marks each message in MessageList as not having been read. Identical to the new, New, and unread subcommands.
unset OptionList Disables the values of the options specified in OptionList. This action is the inverse of the set subcommand.
Note: The form unset name is equivalent to noname.
version (ve) Displays the version banner for the Mail program.
visual [MessageList] (v) Starts the visual editor using the MessageList as the input field. (This editor can be defined with the set VISUAL= statement.) Any changes made during the editor session are saved back to the messages in the MessageList.
write [MessageList] File (w) Saves a message without heading information to a file or folder. Displays the file name 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 headings of the messages in that group. If a + or no argument is given, then headings in the next group are shown. If a - argument is given, the headings in the previous group are shown.

Mail Editor Subcommands for the mail, Mail Command

By default, the Mail program treats lines beginning with the ~ (tilde) character as subcommands. The following list describes the subcommands used while in the mail editor. The editor recognizes subcommands only if you enter them at the beginning of a new line.

~? Displays a summary of the mail subcommands.
~!Command The command interpreter specified by SHELL will be invoked with two arguments: -c and command. The standard output of command will be inserted into the message.
~a Inserts the value of the sign variable into the text of the message, followed by a newline character. Identical to ~i sign.
~A Inserts the value of the Sign variable into the text of the message, followed by a newline character. Identical to ~i Sign.
~b AddressList Adds names in AddressList to the list of addresses to receive blind copies of the message. The ~b subcommand can only be used to add to, not change or delete, the contents of the Bcc: List.
~c AddressList Adds names in AddressList to the list of people to receive copies of the message. The ~c subcommand can only be used to add to, not change or delete, the contents of the Cc:  List.
~d Appends the contents of the dead.letter file to the end of the message.
~e Starts the alternate editor using the message text as the input file. (This editor can be defined with the set EDITOR= statement in the Bourne shell.) When you exit that editor, you return to the mail editor, where you may add text, or send the message by exiting the Mail program.
~f [MessageList] Includes a MessageList in the current message to forward the message to another user. This subcommand reads each message in the MessageList and appends it to the current end of the message, but does not indent the appended message. This subcommand is also used to append messages for reference whose margins are too wide to embed with the ~m subcommand. This subcommand works only if you entered the mail editor from the mailbox prompt using either the mail, reply, or Reply subcommand.
~F [MessageList] Equivalent of the ~f, except that all headers will be included in the message, regardless of previous discard, ignore, and retain commands.
~h Enables you to add or change information in all of the heading fields. The system displays each of the four heading fields, one at a time. You can view the contents of each field and delete or add information to that field. Press the Enter key to save any changes to the field and to display the next field and its contents.
~i string Inserts the value of the named variable, followed by a newline character, into the text of the message. If the string is unset or null, the message will not be changed.
~m [MessageList] Includes a MessageList in the current message for reference purposes. This subcommand reads each message in the MessageList and appends it to the current end of the 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 either the mail, reply, or Reply subcommand.
~M [MessageList] Equivalent of the ~m, except that all headers will be included in the message, regardless of previous discard, ignore, and retain commands.
~p Displays the entire message, including header information.
~q Quits the editor without sending the message. 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 replaced with the partially completed message.
Note: You can also quit the editor by using the Interrupt (Ctrl-C) key sequence twice.
~r File Reads the contents of a file into the current message.
~s String Changes the subject field to the phrase specified in String. You cannot append to the subject field with this subcommand.
~t AddressList Adds the addresses in AddressList to the To: field of the message. The ~t subcommand can only be used to add to, not change or delete, the contents of the To: List.
~v Starts the visual editor using the message text as the input file. This editor can be defined with the set VISUAL= statement in the Bourne shell.) When you exit that editor, you return to the mail editor where you may add text to the message, or send the message by exiting the Mail program.
~w File Writes the message to the named file.
~x Exits as with ~q, except the message will not be saved in the dead.letter file.
~: Subcommand Executes the subcommand specified by Subcommand and returns to the mail editor.
~| Command Pipes the message through the command Command as a filter. If Command gives no output or terminates abnormally, it retains the original text of the message. Otherwise, the output of Command replaces the current message. The fmt command is often used as Command to format the message.
~< file Reads the contents of a file into the current message.
~<!Command Allows you to run a shell command. The shell runs with the -c flag and the Command specified. The standard output of Command is inserted into the message.
~~ Allows you to use the ~ (tilde) character in a message without it being interpreted as a command prefix. The ~~ key sequence results in only one character being sent in the message.

Files

$HOME/.mailrc Contains the mail subcommands to customize the Mail program for a specific user.
$HOME/mbox Contains your personal mailbox.
/usr/share/lib/Mail.rc Contains the file with mail subcommands to change the Mail program for all users on the system.
/var/spool/mail/* Contains system mailboxes for all users.
/usr/bin/mail Contains the mail command.
/usr/bin/Mail Contains the Mail command.
/usr/bin/mailx Contains the mailx command.

Related Information

The bellmail command, fmt command, pg command, sendmail command.

The .mailrc file format.

Mail Overview, Creating and Sending Mail, Receiving and Handling Mail in AIX Version 4.3 System User's Guide: Communications and Networks.

Reading Mail, Replying to Mail, Displaying the Contents of Your Mailbox, Editing a Message, Folders in AIX Version 4.3 System User's Guide: Communications and Networks.

Customizing the Mail Program, Starting the Mail Editor, Displaying a Message While in the Mail Editor, Changing or Adding to the Heading Fields of a Message in AIX Version 4.3 System User's Guide: Communications and Networks.

Checking for Misspelling in the Mail Editor, Reformatting a Message in the Mail Editor, Changing Text Editors Used for Entering Messages in AIX Version 4.3 System User's Guide: Communications and Networks.

Mailbox Subcommands for the mail Command.


[ Previous | Next | Contents | Glossary | Home | Search ]