Section: User Commands (1)
mail -words [-dEIinv ] [-a header ] [-b bcc-addr ] [-c cc-addr ] [-s subject ] to-addr ...
mail [-dEIiNnv ] -f [file ]
The options are as follows:
$ mail -f /var/mail/user
except that locking is done.
At startup time, mail will execute commands in the system command file, /etc/mail.rc unless explicitly told not to by using the -n option. Next, the commands in the user's personal command file ~/.mailrc are executed. mail then examines its command line options to determine whether the user requested a new message to be sent or existing messages in a mailbox to be examined.
To send a message to one or more people, mail can be invoked with arguments which are the names of people to whom the mail will be sent. You are then expected to type in your message, followed by a control-D (`^D' ) at the beginning of a line. The section below, Sx Replying to or originating mail , describes some features of mail available to help you compose your letter.
In normal usage, mail is given no arguments and checks your mail out of the post office, then prints out a one line header of each message found. The current message is initially set to the first message (numbered 1) and can be printed using the print command (which can be abbreviated p ) Moving among the messages is much like moving between lines in ed?(1); you may use + and - to shift forwards and backwards, or simply enter a message number to move directly.
After examining a message you can delete (d ) or reply (r ) to it. Deletion causes the mail program to forget about the message. This is not irreversible; the message can be undeleted (u ) by giving its number, or the mail session can be aborted by giving the exit (x ) command. Deleted messages, however, will usually disappear, never to be seen again.
Commands such as print and delete can be given a list of message numbers as arguments to apply to a number of messages at once. Thus delete 1 2 deletes messages 1 and 2, while delete 1-5 deletes messages 1 through 5.
Messages may also be selected using one of the following categories:
You can use the reply command to set up a response to a message, sending it back to the person who it was from. Text you then type in, up to an end-of-file, defines the contents of the message. While you are composing a message, mail treats lines beginning with the tilde (`~' ) character specially. For instance, typing ~m (alone on a line) will place a copy of the current message into the response, right shifting it by a single tab-stop (see the indentprefix variable, below). Other escapes will set up subject fields, add and delete recipients to the message, and allow you to escape to an editor to revise the message or to a shell to run some commands. (These options are given in the summary below.)
You can end a mail session with the quit (q ) command. Messages which have been examined go to your mbox file unless they have been deleted, in which case they are discarded. Unexamined messages go back to the post office (see the -f option above).
It is also possible to create personal distribution lists so that, for instance, you can send mail to ``cohorts '' and have it go to a group of people. Such lists can be defined by placing a line like
alias cohorts bill ozalp jkf mark [[mailto:[email protected]|[email protected]]]
in the file .mailrc in your home directory. The current list of such aliases can be displayed with the alias command in mail System wide distribution lists can be created by editing /etc/aliases (see aliases?(5)); these are kept in a different syntax. In mail you send, personal aliases will be expanded in mail sent to others so that they will be able to reply to the recipients. System wide aliases are not expanded when the mail is sent, but any reply returned to the machine will have the system wide alias expanded as all mail goes through an MTA.
Recipient addresses (any of the ``To , ``Cc or ``Bcc'' header fields) are subject to expansion when the expandaddr option is set.
An address may be expanded as follows:
<UL> <LI>An address that starts with a pipe (`|' ) character is treated as a command to run. The command immediately following the `|' is executed with the message as its standard input.</LI> <LI>An address that starts with a `+' character is treated as a folder.</LI> <LI>An address that contains a `/' character but no `!' , `%' , or `@' characters is also treated as a folder.</LI> <LI>If none of the above apply, the recipient is treated as a local or network mail address.</LI> </UL>
(Adapted from the ``Mail Reference Manual .''
Each command is typed on a line by itself, and may take arguments following the command word. The command need not be typed in its entirety -- the first command which matches the typed prefix is used. For commands which take message lists as arguments, if no message list is given, then the next message forward which satisfies the command's requirements is used. If there are no messages forward of the current message, the search proceeds backwards, and if there are no good messages at all, mail types ``applicable messages '' and aborts the command.
Here is a summary of the tilde escapes, which are used when composing messages to perform special functions. Tilde escapes are only recognized at the beginning of lines. The name ``tilde escape'' is somewhat of a misnomer since the actual escape character can be set by the option escape
Options are controlled via set and unset commands. Options may be either binary, in which case it is only significant to see whether they are set or not; or string, in which case the actual value is of interest. The binary options include the following:
mail utilizes the HOME LOGNAME USER SHELL DEAD PAGER LISTER EDITOR VISUAL REPLYTO MAIL MAILRC and MBOX environment variables.
The mailx utility is compliant with the St -p1003.1-2008 specification.
The flags [-iNnu ] are marked by St -p1003.1-2008 as being optional.
The flags [-eFH ] are marked by St -p1003.1-2008 as being optional, and are not supported by this implementation of mailx
Usually, Mail and mailx are just links to mail which can be confusing.
Tutoriais de Tecnologia Web