Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

biff(1)

csh(1)

ksh(1)

ls(1)

mail(1)

pg(1)

sh(1)




mailx(1) mailx(1)
NAME mailx - enables you to send and receive messages electronically SYNOPSIS mailx [-d] [-e] [-f [filename]] [-F] [-h number] [-H] [-i] [-n] [-N] [-r address] [-s subject] [-u user] [-U] [name]... ARGUMENTS -d Turns on debugging output; neither particularly interesting nor recommended. -e Tests for the presence of mail. The mailx program prints nothing and exits with a successful return code if there is mail to read. -f [filename] Read messages from filename instead of /usr/mail/login-name. If no filename is specified, the default is used, $HOME/mbox or $MBOX is used. (See ``Environment Variables.'') -F Records the message in a file named after the first recipient. Overrides the record variable, if set. (See ``Environment Variables.'') -h number Specifies the number of network ``hops'' made so far. This is provided for network software to avoid infinite delivery loops. -H Prints the header summary only. -i Ignores interrupts. See also ignore in ``Environment Variables.'' -n Does not initialize from the system default /usr/lib/mailx/mailx.rc. -N Does not print the initial header summary. name Specifies the login name of the user you wish to send mail to. The name specification can take several forms: login names, shell commands, or alias groups. Login names may alternately be any network address, including mixed network addressing. If a name replacement begins with a pipe symbol (|), the remainder of the name must be a shell command through which the message can be routed. This provides an automatic interface with any program that reads the standard input. For example, |lp can be January 1992 1



mailx(1) mailx(1)
specified as one of the destination names so that the outgoing mail message is also printed. Alias groups are set by the a[lias] command (see ``Commands,'' later in this section). The alias command establishes lists of recipients of any type. -r address Passes address to network delivery software. All tilde commands are disabled. -s subject Sets the Subject header field to subject. -u user Reads any incoming mail for a user with the specified login name. This is only effective if the mailbox file associated with the user account is not read-protected. -U Converts uucp style addresses to internet standards. Overrides the conv environment variable. DESCRIPTION mailx provides a flexible environment for sending and receiving messages electronically. To select a send or receive operating mode, mailx examines its command-line arguments. Any arguments supplied that are not command options select a send mode. In send mode, each name argument is interpreted as a mail destination (recipient). If no name arguments are supplied, mailx selects read-incoming- mail mode. The incoming mail messages are read from a mailbox file (see the -f option). When reading mail, mailx provides commands to facilitate saving, deleting, and responding to messages. When sending mail, mailx allows editing, reviewing, and other modifications of the message as it is entered. In send mode, you are expected to continue typing in lines once the command line is accepted. Each line you type is treated as a portion of the message you are sending. To specify the end of a mail message, type an end-of-file character, or enter a single period at the start of a new line. The mail messages sent by you become incoming mail for the specified recipients. Incoming mail messages are stored in a standard file for each user, called the system mailbox for that user, usually named /usr/mail/login-name. (You may alter this default by using the -f option, as shown later.) When a mailx command is specified to read messages, the mailbox is the default place mailx expects to find them. As messages are read, they are usually marked to be moved to a 2 January 1992



mailx(1) mailx(1)
secondary file for longer-term storage. This secondary file is named mbox and is normally located in the user's home directory (see ``Environment Variables,'' later, for a description of this file). Messages remain in this file until you remove them using an A/UX provision other than one of the mail commands (such as the rm command or an editor such as TextEditor). When reading mail, mailx expects you to enter mail-handling commands in response to the command prompt (normally the ? character). A summary of the incoming mail messages is displayed before the command prompt. This ``header'' summary can be redisplayed at any time using the appropriate (h) command. When sending mail, mailx is in input mode. In input mode, the characters you type are treated as part of the outgoing message, unless you force mailx to treat subsequent text as a command by typing the escape character. If no subject is specified on the command line, a prompt for the subject is printed. As the message is typed, mailx will read the message and store it in a temporary file. Commands may be entered by beginning a line with the escape character (tilde (~) by default) followed by a single command letter and optional arguments. See ``Tilde Escapes'' later in this section, for a summary of these commands. At any time, the behavior of mailx is governed by a set of environment variables. These are flags and valued parameters that are set and cleared via the se[t] and uns[et] commands. See ``Environment Variables,'' later, for a summary of these parameters. At startup time, mailx reads commands from a system-wide file (/usr/lib/mailx/mailx.rc) to initialize certain parameters, then from a private startup file ($HOME/.mailrc) for personalized variables. Most regular commands are legal inside startup files, the most common use being to set up initial display options and alias lists. The following commands are not legal in the startup file: !, C[opy], e[dit], fo[llowup], F[ollowup], ho[ld], m[ail], pre[serve], r[eply], R[eply], sh[ell], and v[isual]. Any errors in the startup file cause the remaining lines in the file to be ignored. Command Interpretation If you press RETURN without an accompanying command while in command mode, the first incoming mail message is displayed. Thereafter (or any time after any message has been displayed), pressing RETURN with no accompanying command displays the next message. January 1992 3



mailx(1) mailx(1)
Each message is assigned a sequential number, which makes it possible to visit messages in any order, not just newest- to-oldest order. At any time, mailx keeps track of the ``current'' message, which is the message most recently displayed. In a ``message header'' report (see the h command) the current message is preceded by a > symbol in the one-line-per-message summary. When you do not supply a message number with those interactive commands that can accept a msglist argument, such commands operate on the current message. A msglist is one or more message specifications separated by spaces. A message specification may take any of the forms shown in the following list. (Note that the command context affects whether the message specification you supply for msglist can be honored or not.) number Specifies the message number. . Specifies the current message. ^ Specifies the first undeleted message. $ Specifies the last message. * Specifies all messages. n-m Specifies an inclusive range of message numbers. user Specifies all messages from user. /string Specifies all messages with string in the subject line (case ignored). :char Specifies all messages of type char, where char is one of the following: d Specifies all deleted messages. n Specifies all new messages. o Specifies all old messages. r Specifies all previously read messages. u Specifies all previously unread messages. 4 January 1992



mailx(1) mailx(1)
The overall format of the commands is shown here: command [msglist] [arguments] The commands and their functions are described in the following subsection. Other arguments are usually arbitrary strings whose usage depends on the command involved. Filenames, where expected, are expanded via the normal shell conventions (see csh(1)). Special characters are recognized by certain commands and are documented with the commands later. Commands The following is a complete list of mailx commands: !shell-command Escapes to the shell. (See SHELL under ``Environment Variables.'') # comment Specifies a comment. This may be useful in .mailrc files. + Displays the next message (the same as the n command with no arguments). - Displays the previous message. = Prints the current message number. ? Prints a summary of commands. a[lias] alias name... g[roup] alias name... Declares an a[lias] or g[roup] for the given names. The names will be substituted when alias is used as a recipient. Useful in the .mailrc file. alt[ernates] name... Declares 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 arguments, alt[ernates] prints the current list of alternate names. (See also allnet under ``Environment Variables.'') cd [directory] ch[dir] [directory] Changes directory. If directory is not specified, $HOME is used. January 1992 5



mailx(1) mailx(1)
c[opy] [filename] c[opy] [msglist] filename Copies messages to the file without marking the messages as saved. Otherwise equivalent to the s[ave] command. C[opy] [msglist] 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 S[ave] command. d[elete] [msglist] Deletes messages from the mailbox. If autoprint is set, the next message after the last one deleted is printed. (See ``Environment Variables.'') Otherwise, the next message after the last one deleted is made the current message, but it is not automatically displayed. (So without autoprint, after you use the delete command then press RETURN with no accompanying command, mailx attempts to display the second message beyond the deleted message.) di[scard] [header-file] ig[nore] [header-file] Suppresses printing of (discards or ignores) the specified header fields when displaying messages on the screen. Examples of header fields to ignore are status and cc. The fields are included when the message is saved. The P[rint] and T[ype] commands override this command. dp[msglist] dt[msglist] Deletes the specified messages from the mailbox and prints the next message after the last one deleted. Roughly equivalent to a d[elete] command followed by a p[rint] command. ec[ho] string... Echos the given strings (like echo(1)). e[dit] [msglist] Edits the given messages. The messages are placed in a temporary file and the EDITOR variable is used to get the name of the editor (See ``Environment Variables.'') Default editor is ed(1). ex[it] x[it] Exits from mailx, without changing the mailbox. No messages are saved in the mbox (see also q[uit]). 6 January 1992



mailx(1) mailx(1)
fi[le] [filename] fold[er] [filename] Quits the current file of messages and read-in the specified file (folder). Several special characters are recognized when used as filenames, with the following substitutions: % the current mailbox. %user the mailbox for user. # the previous file. & the current mbox. Default file is the current mailbox. folders Prints the names of the files in the directory set by the folder variable. (See ``Environment Variables.'') fo[llowup] [message] Responds to (follows up on) a message, recording the response in a file whose name is derived from the author of the message. Overrides the record variable, if set. See also the F[ollowup], S[ave], and C[opy] commands and outfolder under ``Environment Variables.'' F[ollowup] [msglist] Responds to (follows up on) 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. See also the fo[llowup], S[ave], and C[opy] commands and outfolder under ``Environment Variables.'' f[rom] [msglist] Prints the header summary (``from'' portion) for the specified messages. g[roup]alias name... a[lias]alias name... Declares an a[lias] or g[roup] for the given names. The names will be substituted when alias is used as a recipient. Useful in the .mailrc file. h[eaders] [message] Prints the page of headers which includes the message specified. The screen variable sets the number of headers per page. (See ``Environment Variables.'') January 1992 7



mailx(1) mailx(1)
See also the z command. hel[p] Prints a summary (help list) of commands. ho[ld] [msglist] pre[serve] [msglist] Holds (preserves) the specified messages in the mailbox. i[f] s | r mail-commands el[se] mail-commands en[dif] Conditional executions, where s will execute following mail-commands, up to an el[se] or en[dif], if the program is in send mode (that is, not receiving or reading mail), and r causes the mail-commands to be executed only in receive mode. Useful in the .mailrc file. ig[nore] header-file... di[scard] header-file... Suppresses printing of (ignores or discards) the specified header fields when displaying messages on the screen. Examples of header fields to ignore are status and cc. All fields are included when the message is saved. The P[rint] and T[ype] commands override this command. l[ist] Prints (lists) all commands available. No explanation is given. m[ail] name... Mails a message to the specified users. mb[ox] [msglist] Arranges for the given messages to end up in the standard mbox save file when mailx terminates normally. See mbox under ``Environment Variables'' for a description of this file. See also the ex[it] and q[uit] commands. n[ext] [message] Displays the next message matching message. A msglist may be specified, but in this case, the first valid message in the list is the only one used. This is useful for jumping to the next message from a specific user, since the name would be taken as a command in the absence of a real command. See the discussion of 8 January 1992



mailx(1) mailx(1)
msglists, preceding, for a description of possible message specifications. pi[pe] [msglist] [shell-command] | [msglist] [shell-command] Pipes the message through the given 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 variable. If the page variable is set, a formfeed character is inserted after each message. (See ``Environment Variables.'') pre[serve] [msglist] ho[ld] [msglist] Preserves (holds) the specified messages in the mailbox. P[rint] [msglist] T[ype] [msglist] Prints (types) the specified messages on the screen, including all header fields. Overrides suppression of fields by the ig[nore] command. p[rint] [msglist] t[ype] [msglist] Prints (types) the specified messages. If crt is set, the messages longer than the number of lines specified by the crt variable are paged through the command specified by the PAGER variable. The default command is pg(1). (See ``Environment Variables.'') q[uit] Exits (quits) from mailx, storing messages that were read in mbox and unread messages in the mailbox. Messages that have been saved explicitly in a file are deleted. R[eply] [msglist] R[espond] [msglist] Responds to the author of each message in the msglist. The subject line is taken from the first message. If record is set to a filename, the response is saved at the end of that file. (See ``Environment Variables.'') r[eply] [message] r[espond] [message] Replies to the specified message, including all other recipients of the message. If record is set to a filename, the response is saved at the end of that file. (See ``Environment Variables.'') January 1992 9



mailx(1) mailx(1)
S[ave] [msglist] 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 C[opy], fo[llowup], and F[ollowup] commands and outfolder under ``Environment Variables.'' s[ave] [filename] s[ave] [msglist] filename Appends the specified messages to the end of the given file. The file is created if it does not exist. The message is deleted from the mailbox when mailx terminates unless keepsave is set. (See also ``Environment Variables'' and the ex[it] and q[uit] commands.) mbox is the default filename. se[t] se[t] name se[t] name=string se[t] name=number Defines (sets) a variable called name. The variable may be given a null, string, or numeric value. se[t] by itself prints all defined variables and their values. See ``Environment Variables'' for detailed descriptions of the mailx variables. sh[ell] Invokes an interactive shell. (See also SHELL under ``Environment Variables.'') si[ze] [msglist] Prints the size in characters of the specified messages. so[urce] filename Reads (sources) commands from the given file and returns to command mode. to[p] [msglist] Prints the top few lines of the specified messages. If the toplines variable is set, it is taken as the number of lines to print. (See ``Environment Variables.'') The default is 5. tou[ch] [msglist] Touches the specified messages. If any message in msglist is not specifically saved in a file, it will be placed in the mbox upon normal termination. See ex[it] and q[uit]. T[ype] [msglist] 10 January 1992



mailx(1) mailx(1)
P[rint] [msglist] Prints (types) the specified messages on the screen, including all header fields. Overrides suppression of fields by the ig[nore] command. t[ype] [msglist] p[rint] [msglist] Prints (types) the specified messages. If crt is set, the messages longer than the number of lines specified by the crt variable are paged through the command specified by the PAGER variable. The default command is pg(1). (See ``Environment Variables.'') u[ndelete] [msglist] Restores (undeletes) the specified deleted messages. Will restore only those messages deleted in the current mail session. If autoprint is set, the last message of those restored is printed. (See ``Environment Variables.'') uns[et] name... Causes the specified variables to be erased (unset). If the variable was imported from the execution environment (i.e., a shell variable) then it cannot be erased. ve[rsion] Prints the current version and release date. v[isual] [msglist] Edits the given messages with a (visual) screen editor. The messages are placed in a temporary file and the VISUAL variable is used to get the name of the editor. (See ``Environment Variables.'') w[rite] [msglist] filename Writes the given messages on the specified file, minus the header and trailing blank line. Otherwise equivalent to the s[ave] command. x[it] ex[it] Exits from mailx, without changing the mailbox. No messages are saved in the mbox (see also q[uit]). z[+|-] Scrolls the header display forward or backward one screenful. The number of headers displayed is set by the screen variable. (See ``Environment Variables.'') January 1992 11



mailx(1) mailx(1)
Tilde escapes The following commands may be entered only from input mode, by beginning a line with the escape character (tilde (~) by default). See escape under ``Environment Variables'' for changing this special character. ~!shell-command Escapes to the shell. ~. Simulates end-of-file (terminates message input). ~:mail-command ~_mail-command Performs the command-level request. Valid only when sending a message while reading mail. ~? Prints a summary of tilde escapes. ~A Inserts the autograph string Sign into the message. (See ``Environment Variables.'') ~a Inserts the autograph string sign into the message. (See ``Environment Variables.'') ~b name... Adds the names to the blind carbon copy (bcc) list. ~c name... Adds the names to the carbon copy (cc) list. ~d Reads in the dead.letter file. See DEAD under ``Environment Variables'' for a description of this file. ~e Invokes the editor on the partial message. See also EDITOR under ``Environment Variables.'' ~f [msglist] Forwards the specified messages. The messages are inserted into the message, without alteration. ~h Prompts for Subject line and To, Cc, and bcc lists. If the field is displayed with an initial value, it may be edited as if you had just typed it. ~i string Inserts the value of the named variable into the text of the message. For example, ~A is equivalent to ~i Sign. ~m [msglist] Inserts the specified messages into the letter, 12 January 1992



mailx(1) mailx(1)
shifting the new text to the right one tab stop. Valid only when sending a message while reading mail. ~p Prints the message being entered. ~q Quits from input mode by simulating an interrupt. If the body of the message is not null, the partial message is saved in dead.letter. (See DEAD ``Environment Variables'' for a description of this file.) ~r filename ~< filename ~< ! shell-command Reads in the specified file. If the argument begins with an exclamation point (!), the rest of the string is taken as an arbitrary shell command and is executed, with the standard output inserted into the message. ~s string... Sets the subject line to string. ~t name... Adds the given name to the To list. ~v Invokes a preferred (visual) screen editor on the partial message. See also VISUAL under ``Environment Variables.'' ~w filename Writes the partial message onto the given file without the header. ~x Exits as with ~q except the message is not saved in the DEAD file. ~| shell-command Pipes the body of the message through the given shell-command. If the shell-command returns a successful exit status, the output of the command replaces the message. Environment variables The following are environment variables taken from the execution environment and cannot be altered within mailx. HOME= directory Specifies the user's base of operations. MAILRC= filename Specifies the name of the startup file. The default is $HOME/.mailrc. January 1992 13



mailx(1) mailx(1)
The following variables are internal mailx variables. They may be imported from the execution environment or set via the se[t] command at any time. The uns[et] command may be used to erase variables. allnet Specifies all network names whose last component (login name) matches are treated as identical. This causes the msglist message specifications to behave similarly. The default is noallnet. See also the alt[ernates] command and the metoo variable. append Appends messages to the end of mbox file instead of at the top of mbox, upon termination. The default is noappend (i.e., by default mailx saves messages at the top of mbox on exit). askcc Prompts for the Cc list after message is entered. The default is noaskcc. asksub Prompts for subject if it is not specified on the command line with the -s option. This option is enabled by default. autoprint Enables automatic printing of messages after d[elete] and u[ndelete] commands. The default is noautoprint. bang Enables the special-casing of exclamation points (!) in shell escape command lines, as in vi(1). The default is nobang. cmd=shell-command Sets the default command for the pi[pe] command. There is no default value. conv=conversion Converts uucp addresses to the specified address style. The only valid conversion now is internet, which requires a mail delivery program conforming to the RFC822 standard for electronic mail addressing. Conversion is disabled by default. See also sendmail and the -U option. crt=number Pipes messages having more than number lines through the command specified by the value of the PAGER variable (pg(1) by default). This option is disabled by default. 14 January 1992



mailx(1) mailx(1)
DEAD=filename 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. debug Enables verbose diagnostics for debugging. Messages are not delivered. The default is nodebug. dot Takes a period on a line by itself during input from a terminal as end-of-file. The default is nodot. EDITOR=shell-command Specifies the command to run when the e[dit] or ~e command is used. The default is ed(1). escape=c Substitutes c for the ~ escape character. folder=directory Specifies the directory for saving standard mail files. User-specified filenames beginning with a plus (+) are expanded by preceding the filename with this directory name to obtain the real filename. If directory does not start with a slash (/), $HOME is prefixed to it. In order to use the plus (+) construct on a mailx command line, folder must be an exported sh environment variable. There is no default for the folder variable. See also outfolder, later. header Enables printing of the header summary when entering mailx. This command is enabled by default. hold Preserves all messages that are read in the mailbox instead of putting them in the standard mbox save file. The default is nohold. ignore Ignores interrupts while entering messages. Handy for noisy dial-up lines. The default is noignore. ignoreeof Ignores end-of-file during message input. Input must be terminated by a period (.) on a line by itself or by the ~. command. The default is noignoreeof. See also dot, above. keep Truncates the mailbox to zero length instead of removing it, when the mailbox is empty. The option is disabled by default. January 1992 15



mailx(1) mailx(1)
keepsave Keeps messages that have been saved in other files in the mailbox instead of deleting them. The default is nokeepsave. MBOX=filename The name of the file in which to save messages that have been read. The x[it] command overrides this function, as does saving the message explicitly in another file. The default is $HOME/mbox. metoo Does not delete your login from the list, if your login appears as a recipient. The default is nometoo. LISTER=shell-command Specifies the command (and flag options) to use when listing the contents of the folder directory. The default is ls(1). onehop Disables alteration of the recipients' addresses, improving efficiency in a network where all machines can send directly to all other machines (i.e., one hop away). When responding to a message that was originally sent to several recipients, the other recipient addresses normally are forced to be relative to the originating author's machine for the response. 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 folder above and the S[ave], C[opy], fo[llowup], and F[ollowup] commands. page Inserts a formfeed after each message sent through the pipe. This option is used with the pi[pe] command. The default is nopage. PAGER=shell-command Specifies the command to use as a filter for paginating output. This can also be used to specify the flag options to be used. The default is pg(1). prompt=string Sets the command mode prompt to string. The default is ?. quiet Refrains from printing the opening message and version when entering mailx. The default is noquiet. 16 January 1992



mailx(1) mailx(1)
record=filename Records all outgoing mail in filename. This option is disabled by default. See also outfolder, above. save Enables the 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. screen=number Sets the number of lines in a screenful of headers for the h[eaders] command. sendmail=shell-command Alternates command for delivering messages. The default is mail(1). sendwait Waits for background mailer to finish before returning. The default is nosendwait. SHELL=shell-command Specifies the name of a preferred command interpreter. The default is sh(1). showto Prints the recipient's name instead of the author's name, when displaying the header summary and the message is from you. sign=string Specifies the variable inserted into the text of a message when the ~a (autograph) command is given. This option has no default (see also ~i (in ``Tilde Escapes'')). Sign=string Specifies the variable inserted into the text of a message when the ~A command is given. This option has no default (see also ~i (``Tilde Escapes'')). toplines=number Specifies the number of lines of header to print with the to (top) command. The default is 5. VISUAL=shell-command Specifies the name of a preferred screen editor. The default is vi(1). LIMITATIONS Where shell-command is shown as valid, arguments are not always allowed. Experimentation is recommended. January 1992 17



mailx(1) mailx(1)
Internal variables imported from the execution environment cannot be unset (uns[et]). The full internet addressing is not fully supported by mailx. The new standards need some time to settle down. Attempts to send a message having a line consisting only of a . are treated as the end of the message by mail(1) (the standard mail delivery program). FILES /usr/bin/mailx Executable file /usr/lib/mailx Executable file $HOME/.mailrc Personal startup file $HOME/mbox Secondary storage file /usr/mail/* Post office directory /usr/lib/mailx/mailx.help* Help message files /usr/lib/mailx/mailx.rc Global startup file /tmp/R[emqsx]* Temporary files SEE ALSO biff(1), csh(1), ksh(1), ls(1), mail(1), pg(1), sh(1) A/UX Essentials 18 January 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026