||Home||Switchboard||Unix Administration||Red Hat||TCP/IP Networks||Neoliberalism||Toxic Managers|
|(slightly skeptical) Educational society promoting "Back to basics" movement against IT overcomplexity and bastardization of classic Unix|
|News||SMTP Mail||Recommended Links||Pipes in ~/.forward File||Dot forward file||Mail aliases|
|Scriptable and Command Line Mailers||Mutt||Grepmail||Perl Mail Processing Scripts||Spam|
|The Unix Haterís Handbook||Horror Stories||Humor||Etc|
The external mailx command is an electronic post office. You can send, receive, and store messages using the mailx command. It is based on the old mail command but provides a much better interface for handling messages. More modern and more capable version of mail command line client is Mutt which is cabale of handing attachment when sending emails.
To invoke the UNIX mail utility program to send messages, type
mailx -s subject email-names
where email-names is a list of electronic mail names of people to whom you wish to send the message and subject is the subject (or title) of the message being sent. The email name may be as simple as name or name@machine or may require the name followed by a fully qualified host/domain name (e.g. [email protected]). If the mailx command does not prompt you for a subject (which is nice to include for the receiver of the mail), it can be included with the -s option.After invoking the mailx utility, simply type in lines of text (hit the <Return> key after entering each text line). When you are done entering the message, hit <Ctrl>-D (at the start of a new line) to send the message (and exit back to the system or UNIX prompt). To abort a message and exit mailx, type <Ctrl>-C twice.
|~?||to list all tilde (~ ) escapes (i.e. a help display)|
|~p||to list the text of the message typed in so far|
|~s subj||to set or change the current subject field to subj|
|~t enams||to add the enams list of email names to the current list of email-names|
|~h||to list and to modify the subject and/or the email-names list|
|~! cmd||to execute the UNIX command cmd from within mailx utility|
|~r fname||to read the file fname into the message at current position|
|~v||to invoke the vi editor on the message text to edit it|
|~q||to exit mailx, and
to save the current message in the file named dead.letter in your home directory
mailxA response "No mail for user_name" means there are no new or old saved mail messages. Entering the utility means you have mail (when you log in the system informs you if you have mail).
The following commands may be used within mailx:
|h||to list the headers of the mail messages in your mailbox|
|<Return>||to continue the current or display (print) the next mail message in your mailbox|
|+ or n||to display (print) the next mail message in your mailbox|
|- or z||to display (print) the previous mail message in your mailbox|
|#||to display (print) the message numbered # in your mailbox|
|t MSGS||to display (print) the messages indicated by the message range MSGS|
|d MSGS||to delete the messages indicated by the message range MSGS|
|s MSGS fname||to saved the messages indicated by the message range MSGS to the file named fname|
|R msg||to reply (and send mail) to the authors of the message msg|
|r msg||to reply (and send mail) to all the recipients of the message msg|
|m name||to send mail message to person named name and enter current message text|
|top MSGS||to list the top 5 lines of each message indicated by the message range MSGS|
|q||to quit and preserve all unread messages in your mailbox|
|x||to quit and preserve all messages in your mailbox|
Mailx comes with a large number of switches and configuration settings to allow for highly customized use. These options are as follows:
|-d||Start debugging output.|
|-e||See if there is any mail present. If there isn't, it returns nothing to the screen and gives a successful return code.|
|-F||Put the message in a file whose name is that of the first recipient. This also overrides the record variable, if it is set.|
|-H||Print only the header.|
|-I||Ignore interrupts (can also be set with the ignore variable).|
|-n||Don't initialize mail from the system default Mail.rc file.|
|-N||Don't print header.|
|-U||Convert uucp addresses to Internet standard addresses. This option overrides the environment variable conv.|
|-v||This passes the -v flag to the sendmail utility.|
|-f [filename]||Tells it to read messages from filename instead of the system mailbox. If there is no filename specified, it reads messages from mbox.|
|-f [folder]||Use the file folder in folder directory (this is the same as the folder command). The name of the directory is listed in the folder variable.|
|-h [number]||This is the number of network "hops" made to this point. This is provided so that infinite delivery loops do not occur. This is also related to the TTL, or time to live for a mail message packet.|
|-r [address]||Pass the address to the MTA or network delivery software. It is important to note that all tilde (~) commands are invalid in this option.|
|-s [subject]||Make the Subject header field as subject.|
|-T [file]||This option prints the contents of the article-id fields of all messages on file. This is used for network news programs such as pointcast, etc.|
|-u [user]||This options allows you to read a specific user's mailbox. This only works of you have the correct permissions to that user's home directory.|
On starting mail, a system-wide file is read for commands. This file is /usr/lib/Mail.rc. These commands are read to initialize certain variables, after which it reads from the private start-up file of the user who started the mail utility. This file is called .mailrc, and it is normally placed in the user's home directory. It can, however, be placed and accessed elsewhere by modifying the MAILRC environment variable for your personal commands and variable settings.
The .mailrc file is usually used for setting up initial display options and lists of aliases. You store your initial commands here when you start up mail. The following commands, however, are not valid in this file: !, Copy, edit, followup, Followup, hold, mail, preserve, reply, Reply, replyall, replysender, shell, and visual. Also, if there is an error in that file, the remaining lines are ignored.
By using a template .mailrc file, you can easily standardize each user's mail interface with very little difficulty. All you have to do (obviously) is copy that template into the users' home directories, and (if necessary) do some minor editing for each user's particular needs.
You can send a message directly to another user or users by including names of recipients on the command line. If no recipients appear on the mailx command line, mailx enters command mode, where you can read messages sent to you. If you don't have any messages, it simply sends the message to standard output no mail for username and then exits the mail utility.
While you are in command mode (that is, while reading messages), you can also send messages.
When you are composing a message to send, mail is in input mode. If you don't specify a subject as an argument to the command, mail queries you for a subject. After you enter a subject, mail enters input mode, at which point you can start writing the body of the message you want to send.
While you're typing the message, mail stores it in a temporary file. This temporary file is used for reviewing or modifying the message. By using the appropriate tilde escape sequences (~:) at the beginning of an input line, you can modify the message text.
After you are in the body of your text, enter a dot (EOF) on a line by itself to actually send the message. At this point, mail submits the message to sendmail for routing to each recipient.
The recipients can be a local username or usernames, an internet address (name@domain), a uucp address of the form [host!...host!]host!username, filenames for which you have write permission, or alias groups. If the name of the recipient begins with a pipe symbol (|), the remainder of the name is taken as a shell through which the message is piped. This can be used with any program that reads standard input, such as lpr, to record outgoing mail on a printout.
An alias group is simply the name of a list of recipients that is set by the alias command. The alias command takes the names from the /etc/aliases file, or it can be taken from the Network Information Service (NIS) aliases domain.
While you are composing messages to send, the following tilde escape commands can be used. They all must appear at the start of the input line. The escape character (~) can be changed by setting a new value for the escape variable. The escape character can be entered as text by typing it twice.
|~! [shell-command]||This lets you escape to the shell. If a shell command is entered, it is then run.|
|~.||This simulates EOF (terminate mail message input and send message)|
|These allow you to perform the indicated command. You can only use them when sending a message while reading a mail message.|
|~?||This prints a summary of the tilde escapes.|
|~A||This inserts the autograph string Sign into the current message.|
|~a||This inserts the autograph string sign into the message.|
|~b name ...||This adds the names to the blind carbon copy (Bcc) list. This command is similar to the carbon copy (Cc) list, but the names in the Bcc list are not shown the message header.|
|~c name ...||This adds the names to the carbon copy (Cc) list (and these names show up in the message header).|
|~d||This command lets you read in the dead.letter file. This file's name is listed in the variable DEAD, which can be modified.|
|~e||This command invokes the editor to edit
the message. The default editor is ex. This is defined in the
TIP: Using the ex editor is a real pain. If you are used to using the vi editor, change the EDITOR variable to vi.
|-f [message-list]||This command lets you forward the listed messages or the current message being read. This only works when sending a message while you are reading mail. The messages are inserted without being altered.|
|~h||This command prompts you for the message header lines: Subject, To, From, Cc and Bcc. To edit the header lines, simply backspace over it and retype.|
|~i [variable]||This lets you insert the value of the named variable into the message.|
|~m [message-list]||This command lets you insert text from the specified messages or the current message into the letter. This is only valid if you are sending a message while reading mail. The text message gets shifted to the right, and whatever string is contained in the indentprefix variable gets inserted as the leftmost characters of each line.|
|~p||This prints the message being entered.|
|~q||This gets you out of the input mode. If you were entering a message and did not save it, whatever you entered to that point is saved in the dead.letter file.|
|These commands let you read in the text from the specified file or the standard output of the specified shell-command.|
|~s subject||This sets the subject line to subject.|
|~t name||Add each name to the list of recipients. This is similar to setting up a distribution list.|
|~v||This command invokes the visual editor to edit the message. The particular editor that it uses is listed in the VISUAL variable, and the default is the vi editor.|
|~w filename||This writes the message text into the specified filename, minus the header.|
|~x||This exits the message the same as ~q, but it does not save the message in the dead.letter file.|
|~| shell-command||This pipes the body of the message through the given shell command. If the shell command exits successfully, the command output replaces the message.|
The first thing you see when you enter the command mode (immediately after running the mailx command) is a header summary of the first several messages, followed by a prompt for one of the commands listed below. By default, the prompt is an ampersand (&).
Each message has a reference number in front of it. The current message is marked by a > in the header summary. The commands that take an optional list of messages should be used with the reference number; if no number is given, the current message is affected.
The message-list is simply a list of message specification, separated by space characters (space delimited), which can include the following:
|.||Specifies the current message.|
|n||Denotes the message number n|
|^||Specifies the first undeleted message.|
|$||Specifies the last message.|
|+||Specifies the last message.|
|-||Specifies the previous undeleted message.|
|*||Specifies all messages.|
|n-m||Specifies an inclusive range of message numbers.|
|User||Specifies all the messages from user.|
|/string||Specifies all the messages with string in the subject line (upper and lower case is ignored).|
|:c||This specifies all messages of type c. c can be one of the following:|
If you are in command mode and you just hit enter with no arguments, mailx assumes that you want to print the messages and starts printing to the default printer (if one is defined). The complete list of commands is as follows:
This command escapes you to the shell command. The shell to which you escape (Bourne, Korn, etc.) is defined in the SHELL variable.
This can be used or placing comments in your command, just as you would place comments in you .mailrc file. You must have a blank space between the # sign and the start of your comments.
This lets you print the current message number.
This will show you a summary of commands (for people like me with poor memories).
alias [alias recipient...]
group [alias recipient] This declares an alias for the given list of recipients. In much the same way as distributions lists work in other mail readers, mail will be sent to the entire alias (or group) specified. These aliases can be defined in the .mailrc file. To get a listing of the defined aliases, simply type in the command "alias" by itself.
This command lets you declare a list of alternate names for your login. When responding to a message, mail will not be sent to these names. If no arguments are supplied, this will show a current list of alternate names.
This command allows you to change the current directory. Just as within the Korn or Bourne shell, cd without an argument uses the environment variable $HOME as the directory.
This command copies messages to the filename without marking the messages as saved. All other functions are equivalent to the save command.
This saves the specified messages in a file whose name is derived from the authors user name, also without marking the message as saved. This is otherwise equivalent to the Save command.
This deletes messages from the system mailbox.If the autoprint variable is set to on, it also prints the next message following the last message that was deleted.
These commands will suppress the printing of the specified header fields when displaying messages on the screen, such as "Status" and "Received". By default, unless the variable alwaysignore is set, all header fields are included in the saved message. This does not apply to the Type or Print commands.
These commands are equivalent to the delete command followed by the print command, as they first deletes the specified messages from the system mailbox and prints the following one.
This command edits the given messages. Each of the messages are put in a temporary file and the EDITOR variable is used to the name of the editor (preferably vi). The default editor is ex.
These commands will exit you from the system mailbox without any changes. If you use this command, you will not save any messages in mbox.
file [filename] folder [filename]
These commands quit you out of the current malbox file and read in the named mailbox file. There are certain special characters used as filenames, such as:
|%||The current user's mailbox.|
|&||Read previously read messages from your mbox.|
|+filename||A filename in a specified folder directory. The folder directory is also listed in the folder variable.|
If no arguments are used, file simply shows the name of the current mail file, as well as the number of characters and messages it contains.
This command only prints the name of each mail file in the folder directory.
This commands responds to a message and records the response in a file. The name of this file is derived from the author of the message. This command also overrides the record variable if it is set.
This shows the header information for the indicated message or current message.
This prints a summary of all commands.
These commands hold the specified messages in the system mailbox.
if s|r|t mail-command ... else mail-command ... endif
This is a conditional execution, used primarily in the .mailrc file. The command will execute up to an elseif or an endif. If s is used, the command will run if the program is in send mode; if r is chosen, the command executes only if in receive mode; if t is chosen, the command is run only if mail is run from a terminal.
load [message] filename
This command will let you load the specified message from the name file. This allows you to load a single saved message from filename, including headers.
This command sends a message to the specified recipient.
This marks each message in a message list as having been read.
This exits the mail command. It also saves the messages that were read in the mbox file and keeps the unread messages in the system mailbox.
These commands allow you to send a response to the author of each message in messasge-list.
These commands let you reply to the specified message, sending a response to each recipient of that message. If the replyall variable is set, the replyall command always sends the reply to all recipients of the message.
save [message-list] [filename]
This command will save the specified message in the specified filename. If the filename does not exist, it is created. If no filename is specified, the file named in the MBOX variable is used (mbox by default). Once the message is saved it is deleted from the system mailbox unless the keepsave variable is set.
This lets you define a variable and assign a value to it. You must use an = sign between the variable name and the value (with no spaces).
This invokes the shell as defined in the SHELL variable.
This let you read commands from the given file name and return to the command mode.
This restores deleted messages. It only works on messages deleted in the current mail session.
unset variable ...
This will undefine a specified variable or variables. This will not work on imported variables such as environment variables from the shell.
This will scroll the header display either forward (+) or backward (-) by one screen.
In order to forward a message you must include it in a message to the recipients with the ~f or ~m tilde escapes. You can define a list of recipients in a file in your home directory to forward mail to automatically called .forward. The list must be comma separated and the address must be valid or the messages will bounce without any warnings.
Mail behavior is defined by a set of variables in your .mailrc file. The necessary environment variables are as follows:
This is the user's home directory.
This is the name of the initial mailbox file to read. By default it is set to /var/spool/mail/username.
This is the name of each user's personal start-up file, which is $HOME/.mailrc by default.
These variables cannot be modified from within mail. They must be set before you begin a mail session.
The specific mail variable for each user is set in the .mailrc file in each user's home directory. The following are all of the mail variables that can be altered either in the .mailrc file or by using the set (or unset) command:
For all network names whose login name components match, treat them as identical. The default is noallnet.
This tells mail to always ignore the header fields, not just during print or type. This will affect the save, Save, copy, Copy, top, pipe, and write commands, as well as the ~m and ~f tilde escapes.
This will append messages to the end of the mbox file when you exit instead of prepending them. By default this is set as noappend.
This will prompt you for the Cc list after you enter a message. The default is noaskcc.
This will ask you for a subject. This is enabled by default.
This will automatically print messages after the delete or undelete commands are run. By default this is set to noautoprint.
This enables use of the exclamation point or "bang" as a shell escape command, such as in the vi editor.
This will set the default command for the pipe command. This has no default value.
This variable converts UUCP addresses to the address style you specify. The style can be one of the following:
Use this if you are using a mail delivery program that conforms to the RFC232 standard for electronic mail addressing.
This will remove loops in the UUCP address path, which are usually generated by the reply command. There is no rerouting performed since mail doesn't know anything about UUCP routes or connections.
Conversion is disabled by default.
This will pipe the messages which contain more than number lines through the command which is specified by the PAGER variable. This is the more command by default.
You can specify the name of the file where a partial letter is saved in case of an interrupted session. By default this is defined as the dead.letter file in the user's home directory.
This will turn on the verbose diagnostics for debugging. The default setting is nodebug.
This will read a dot on a line by itself as an EOF marker. By default this is set as nodot, but dot is set in the global startup file.
This enables you to edit the headers as well as the body of the message when you use the ~e and ~v commands.
This defines the editor (or command) to run when you use the edit or ~e command. By default this is set to ex.
This will substitute c for the tilde (~) escape character.
This is the defined directory for saving standard mail files. If the user specifies a file name beginning with a plus (+), the file name is expanded with the directory name preceding it.
This prints the header when you enter mail. This is enabled by default.
This keeps all read messages in the system mailbox instead of moving them to mbox. The default is nohold.
This will tell it to ignore interrupts while entering messages. The default is noignore.
By default, string is set the TAB key. It is used to mark indented lines from messages included with ~m.
This is set by default to the ls command; used to list the files in the folder directory.
This sets the file name where messages are saved after being read. The default is $HOME/mbox.
This can be used in a local area network (no router between machines). Normally, when several recipients are sent mail, their addresses are forced to be relative to the originating author's machine, which allows ease of response from the recipients. This flag greatly reduces traffic "over the wire."
This locates the files used to save the outgoing messages. The default is nooutfolder.
This will insert a form feed after each message sent through a pipe. nopage is the default.
This is used for paginating the messages on the screen. By default it is set to more, but pg can also be used.
This will allow you to set the prompt in command mode. By default it's set to &.
This will enter mail without the opening message being displayed. This is disabled by default.
This will record all outgoing mail in filename. This is disabled by default.
This will have the opposite the effect of the reply and Reply commands.
If this is set on, the mail message will be saved to the dead.letter file if it is interrupted on delivery. Set on as default.
This will define how many lines you can have for headers. This is used by the headers command.
This allows the background mailer to finish before returning to command mode. The default setting is nosendwait.
This will define the preferred shell you use when you escape to a shell. By default it is set to sh. It will first go to the inherited shell from the environment.
If the ~a (autograph) command is given, includes the autograph text in the message. There is no default.
This tells the top command how many lines of the header to print. This is set to 5 by default.
This will invoke sendmail with the -v flag.
This points to the preferred visual screen editor, which is vi by default.
So much for the .mailrc settings. If you have the mail utility installed on your server or workstation, take a look at the .mailrc file to get a feel for how the file is put together.
A related file is the /usr/lib/Mail.rc file. This is the global startup file, which was referred to earlier in this section. This sets up the initial settings for the mail utility for each user, and it contains most of the default variables that are included with the initial .mailrc file.
Have not done this myself. However, a quick Google search found these links
to info on the subject.
On Pine email. (See the FAQ for info on attachments.)
Hope that helps,
You can use the tilde (~) commands to edit, review, and modify your message before sending it to the recipient. You can list, display, save, delete, and pipe messages while in command mode. In general terms mailx provides you with a memo/message handler. You can send to one or multiple users. You can reply to the original author or to the author and all other recipients of a message. It even allows you to store messages and replies in files based on user names.
Like many of the UNIX commands mailx has been changed and enhanced by most vendors. Therefore, there is no guarantee the information that follows pertains exactly to your system's mail program. The mailx information that follows is AT&T System V. The mail information is from various BSD based systems. Information common to all systems was used, hopefully providing a complete base of information for the BSD mail command.
Throughout the module we refer to the mailx command. The BSD mail command is assumed to be synonymous unless stated differently.
mailx [-BdeHiInNURvV~] [ -f [file | +folder] ] [-T file] [-u user]
mailx [-BdFintUv~] [-b bcc] [-c cc] [-h number] [-r address] [-s subject] recipient...
The mail utilities listed above provide a comfortable, flexible environment for sending and receiving mail messages electronically.
When reading mail, the mail utilities provide commands to facilitate saving, deleting, and responding to messages. When sending mail, the mail utilities allow editing, review- ing and other modification of the message as it is entered.
Incoming mail is stored in a standard file for each user, called the mailbox for that user. When the mail utilities are called to read messages, the mailbox is the default place to find them. As messages are read, they are marked to be moved to a secondary file for storage, unless specific action is taken, so that the messages need not be seen again.This secondary file is called the mbox and is normally located in the user's HOME directory (see MBOX in ENVIRON- MENT VARIABLES for a description of this file). Messages can be saved in other secondary files named by the user. Mes- sages remain in a secondary file until forcibly removed.
The user can access a secondary file by using the -f option. Messages in the secondary file can then be read or otherwise processed using the same Commands as in the primary mailbox. This gives rise within these pages to the notion of a current mailbox.
-B Do not buffer standard input or standard output.
-b bcc Set the blind carbon copy list to bcc. bcc should be enclosed in quotes if it contains more than one name.
-c cc Set the carbon copy list to cc. cc should be enclosed in quotes if it contains more than one name.
-d Turn on debugging output. (Neither particularly interesting nor recommended.)
-e Test for the presence of mail. mailx prints nothing and exits with a successful return code if there is mail to read.
-F Record the message in a file named after the first recipient. Overrides the record variable, if set (see Internal Variables).
-f [file] Read messages from file instead of mailbox. If no file is specified, the mbox is used.
-f [ +folder] Use the file folder in the folder directory (same as the folder command). The name of this directory is listed in the folder variable.
-H Print header summary only.
-h number The number of network "hops" made so far. This is pro- vided for network software to avoid infinite delivery loops. This option and its argument are passed to the delivery program.
-I Include the newsgroup and article-id header lines when printing mail messages. This option requires the -f option to be specified.
-i Ignore interrupts. See also ignore in Internal Vari- ables.
-N Do not print initial header summary.
-n Do not initialize from the system default mailx.rc or Mail.rc file. See USAGE.
-r address Use address as the return address when invoking the delivery program. All tilde commands are disabled. This option and its argument is passed to the delivery program.
-s subject Set the Subject header field to subject. subject should be enclosed in quotes if it contains embedded white space.
-T file Message-id and article-id header lines are recorded in file after the message is read. This option also sets the -I option.
-t Scan the input for To:, Cc:, and Bcc: fields. Any recipients on the command line will be ignored.
-U Convert UUCP-style addresses to internet standards. Overrides the conv environment variable.
-u user Read user's mailbox. This is only effective if user's mailbox is not read protected.
-V Print the mailx version number and exit.
-v Pass the -v flag to sendmail(1M).
-~ Interpret tilde escapes in the input even if not read- ing from a tty.
recipient Addressee of message.
At startup time, mailx executes the system startup file /etc/mail/mailx.rc. If invoked as mail or Mail, the system startup file /etc/mail/Mail.rc is used instead.
The system startup file sets up initial display options and alias lists and assigns values to some internal variables. These variables are flags and valued parameters which are set and cleared using the set and unset commands. See Inter- nal Variables.
With the following exceptions, regular commands are legal inside startup files: !, Copy, edit, followup, Followup, hold, mail, preserve, reply, Reply, shell, and visual. An error in the startup file causes the remaining lines in the file to be ignored.
After executing the system startup file, the mail utilities execute the optional personal startup file $HOME/.mailrc, wherein the user can override the values of the internal variables as set by the system startup file.
If the -n option is specified, however, the mail utilities do not execute the system startup file.
Many system administrators include the commands
in the system startup files (to be compatible with past Solaris behavior), but this does not meet standards require- ments for mailx. To get standard behavior for mailx, users should use the -n option or include the following commands in a personal startup file:
When reading mail, the mail utilities are in command mode. A header summary of the first several messages is displayed, followed by a prompt indicating the mail utilities can accept regular commands (see Commands below). When sending mail, the mail utilities are in input mode. If no subject is specified on the command line, and the asksub variable is set, a prompt for the subject is printed.
As the message is typed, the mail utilities read the message and store it in a temporary file. Commands may be entered by beginning a line with the tilde (~) escape character fol- lowed by a single command letter and optional arguments. See Tilde Escapes for a summary of these commands.
Reading Mail Each message is assigned a sequential number, and there is at any time the notion of a current message, marked by a right angle bracket (>) in the header summary. Many commands take an optional list of messages (message-list) to operate on. In most cases, the current message is set to the highest-numbered message in the list after the command is finished executing.
The default for message-list is the current message. A message-list is a list of message identifiers separated by spaces, which may include:
n Message number n.
. The current message.
^ The first undeleted message.
$ The last message.
* All messages.
+ The next undeleted message.
- The previous undeleted message.
n-m An inclusive range of message numbers.
user All messages from user.
/string All messages with string in the Subject line (case ignored).
:c All messages of type c, where c is one of:
d deleted messages
n new messages
o old messages
r read messages
u unread messages
Notice that the context of the command determines whether this type of message specification makes sense.
Other arguments are usually arbitrary strings whose usage depends on the command involved. Filenames, where expected, are expanded using the normal shell conventions (see sh(1)). Special characters are recognized by certain commands and are documented with the commands below.
Recipients listed on the command line may be of three types: login names, shell commands, or alias groups. Login names may be any network address, including mixed network address- ing. If mail is found to be undeliverable, an attempt is made to return it to the sender's mailbox. If the recipient name begins with a pipe symbol ( | ), the rest of the name is taken to be a shell command to pipe the message through.
This provides an automatic interface with any program that reads the standard input, such as lp(1) for recording outgo- ing mail on paper. Alias groups are set by the alias command (see Commands below) or in a system startup file (for exam- ple, $HOME/.mailrc). Aliases are lists of recipients of any type.
To forward a specific message, include it in a message to the desired recipients with the ~f or ~m tilde escapes. See Tilde Escapes below. To forward mail automatically, add a comma-separated list of addresses for additional recipients to the .forward file in your home directory. This is dif- ferent from the format of the alias command, which takes a space-separated list instead. Note: Forwarding addresses must be valid, or the messages will "bounce." You cannot, for instance, reroute your mail to a new host by forwarding it to your new address if it is not yet listed in the NIS aliases domain.
Commands Regular commands are of the form
[ command ] [ message-list ] [ arguments ]
In input mode, commands are recognized by the escape charac- ter, tilde(~), and lines not treated as commands are taken as input for the message. If no command is specified in com- mand mode, next is assumed. The following is a complete list of mailx commands:
!shell-command Escape to the shell. See SHELL in ENVIRONMENT VARI- ABLES.
# comment NULL command (comment). Useful in mailrc files.
= Print the current message number.
? Prints a summary of commands.
alias alias name ...
group alias name ... Declare an alias for the given names. The names are substituted when alias is used as a recipient. Useful in the mailrc file. With no arguments, the command displays the list of defined aliases.
alternates name ... Declare a list of alternate names for your login. When responding to a message, these names are removed from the list of recipients for the response. With no argu- ments, print the current list of alternate names. See also allnet in Internal Variables.
chdir [directory] Change directory. If directory is not specified, $HOME is used.
copy [message-list] file Copy messages to the file without marking the messages as saved. Otherwise equivalent to the save command.
Copy [message-list] Save 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 command.
delete [message-list] Delete messages from the mailbox. If autoprint is set, the next message after the last one deleted is printed (see Internal Variables).
ignore [header-field...] Suppress printing of the specified header fields when displaying messages on the screen. Examples of header fields to ignore are Status and Received. The fields are included when the message is saved, unless the alwaysignore variable is set. The More, Page, Print, and Type commands override this command. If no header is specified, the current list of header fields being ignored is printed. See also the undiscard and unig- nore commands.
dp [message-list] dt [message-list] Delete the specified messages from the mailbox and print the next message after the last one deleted. Roughly equivalent to a delete command followed by a print command.
echo string ... Echo the given strings (like echo(1)).
edit [message-list] Edit the given messages. Each message is placed in a temporary file and the program named by the EDITOR variable is invoked to edit it (see ENVIRONMENT VARI- ABLES). Default editor is ed(1).
xit Exit from mailx, without changing the mailbox. No mes- sages are saved in the mbox (see also quit).
field [message-list] header-file Display the value of the header field in the specified message.
folder [file] Quit from the current file of messages and read in the specified file. Several special characters are recog- nized when used as file names:
% the current mailbox.
%user the mailbox for user.
# the previous mail file.
& the current mbox.
+file The named file in the folder directory (listed in the folder variable).
With no arguments, print the name of the current mail file, and the number of messages and characters it contains.
Print the names of the files in the directory set by the folder variable (see Internal Variables).
Respond 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. If the replyall variable is set, the actions of Followup and followup are reversed. See also the followup, Save, and Copy commands and outfolder in Internal Variables, and the Starting Mail section in USAGE above.
Groupthink : Two Party System as Polyarchy : Corruption of Regulators : Bureaucracies : Understanding Micromanagers and Control Freaks : Toxic Managers : Harvard Mafia : Diplomatic Communication : Surviving a Bad Performance Review : Insufficient Retirement Funds as Immanent Problem of Neoliberal Regime : PseudoScience : Who Rules America : Neoliberalism : The Iron Law of Oligarchy : Libertarian Philosophy
War and Peace : Skeptical Finance : John Kenneth Galbraith :Talleyrand : Oscar Wilde : Otto Von Bismarck : Keynes : George Carlin : Skeptics : Propaganda : SE quotes : Language Design and Programming Quotes : Random IT-related quotes : Somerset Maugham : Marcus Aurelius : Kurt Vonnegut : Eric Hoffer : Winston Churchill : Napoleon Bonaparte : Ambrose Bierce : Bernard Shaw : Mark Twain Quotes
Vol 25, No.12 (December, 2013) Rational Fools vs. Efficient Crooks The efficient markets hypothesis : Political Skeptic Bulletin, 2013 : Unemployment Bulletin, 2010 : Vol 23, No.10 (October, 2011) An observation about corporate security departments : Slightly Skeptical Euromaydan Chronicles, June 2014 : Greenspan legacy bulletin, 2008 : Vol 25, No.10 (October, 2013) Cryptolocker Trojan (Win32/Crilock.A) : Vol 25, No.08 (August, 2013) Cloud providers as intelligence collection hubs : Financial Humor Bulletin, 2010 : Inequality Bulletin, 2009 : Financial Humor Bulletin, 2008 : Copyleft Problems Bulletin, 2004 : Financial Humor Bulletin, 2011 : Energy Bulletin, 2010 : Malware Protection Bulletin, 2010 : Vol 26, No.1 (January, 2013) Object-Oriented Cult : Political Skeptic Bulletin, 2011 : Vol 23, No.11 (November, 2011) Softpanorama classification of sysadmin horror stories : Vol 25, No.05 (May, 2013) Corporate bullshit as a communication method : Vol 25, No.06 (June, 2013) A Note on the Relationship of Brooks Law and Conway Law
Fifty glorious years (1950-2000): the triumph of the US computer engineering : Donald Knuth : TAoCP and its Influence of Computer Science : Richard Stallman : Linus Torvalds : Larry Wall : John K. Ousterhout : CTSS : Multix OS Unix History : Unix shell history : VI editor : History of pipes concept : Solaris : MS DOS : Programming Languages History : PL/1 : Simula 67 : C : History of GCC development : Scripting Languages : Perl history : OS History : Mail : DNS : SSH : CPU Instruction Sets : SPARC systems 1987-2006 : Norton Commander : Norton Utilities : Norton Ghost : Frontpage history : Malware Defense History : GNU Screen : OSS early history
The Peter Principle : Parkinson Law : 1984 : The Mythical Man-Month : How to Solve It by George Polya : The Art of Computer Programming : The Elements of Programming Style : The Unix Haterís Handbook : The Jargon file : The True Believer : Programming Pearls : The Good Soldier Svejk : The Power Elite
Most popular humor pages:
Manifest of the Softpanorama IT Slacker Society : Ten Commandments of the IT Slackers Society : Computer Humor Collection : BSD Logo Story : The Cuckoo's Egg : IT Slang : C++ Humor : ARE YOU A BBS ADDICT? : The Perl Purity Test : Object oriented programmers of all nations : Financial Humor : Financial Humor Bulletin, 2008 : Financial Humor Bulletin, 2010 : The Most Comprehensive Collection of Editor-related Humor : Programming Language Humor : Goldman Sachs related humor : Greenspan humor : C Humor : Scripting Humor : Real Programmers Humor : Web Humor : GPL-related Humor : OFM Humor : Politically Incorrect Humor : IDS Humor : "Linux Sucks" Humor : Russian Musical Humor : Best Russian Programmer Humor : Microsoft plans to buy Catholic Church : Richard Stallman Related Humor : Admin Humor : Perl-related Humor : Linus Torvalds Related humor : PseudoScience Related Humor : Networking Humor : Shell Humor : Financial Humor Bulletin, 2011 : Financial Humor Bulletin, 2012 : Financial Humor Bulletin, 2013 : Java Humor : Software Engineering Humor : Sun Solaris Related Humor : Education Humor : IBM Humor : Assembler-related Humor : VIM Humor : Computer Viruses Humor : Bright tomorrow is rescheduled to a day after tomorrow : Classic Computer Humor
The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D
Copyright © 1996-2021 by Softpanorama Society. www.softpanorama.org was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.
FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.
This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...
|You can use PayPal to to buy a cup of coffee for authors of this site|
Last modified: November 16, 2020