Previous Table of Contents Next


ENVIRONMENTAL VARIABLES

You can set shell variables and internal mailx variables to control how mailx functions. Shell variables must be set before invoking mailx and cannot be changed from within mailx. Internal variables may be set while you are in command mode or in the .mailrc file.

SHELL VARIABLES

The following variables are normal shell variables. You might want to set them in your .profile (.login or .cshrc-csh) file so they are always set correctly when you log in. For further information about shell variables refer to Module 99. You cannot change the value of these variables while inside mailx.


Variable Description

HOME=directory Defines your home directory. Your home directory is usually the same as your login directory (/u1/ts/mylogin).
MAIL=filename The path where the initial mail is read. The default is /usr/mail/user on SV and /usr/spool/mail/user on BSD.
MAILRC=filename Defines what file should be read by mailx during startup. If you do not define this variable, mailx looks for a file named $HOME/.mailrc.

INTERNAL VARIABLES

These variables are known only to the mailx command. You can set and unset them in the .mailrc file or at the command mode prompt. There are two basic types of variables, Boolean and assignment.

Boolean Variables

The first type is called Boolean. These variables have the value of true or false. If they are set they have a true value. If they are not set they have a false value. For example,

     set askcc

sets the askcc variable to true. Thus after you have entered your message to send, mailx prompts you for a Cc list.

If a variable is set to true, it is referred to as a normal name. If it is unset to false, its name becomes novarname. For example,

     set allnet

sets allnet to true. If you use the unset command to set the variable to false, the name changes to noallnet.

     unset allnet

Assignment Variables

The second type of variables are called assignment variables. That is, you can assign values to the variable. For example,

     set cmd="lp -dlaser"

sets the internal cmd variable to the string "lp -dlaser." So each time you use the pipe command, the messages are sent to the "lp -dlaser" command.

Variable Table

The following table describes the internal variables recognized by mailx. The Boolean variables are listed by name only. Assignment variables are listed with an equal sign (=) and a generic type value required.


Variable Description

addsopt True by default. It informs mailx to use the /bin/mail command to deliver messages. You can use the noaddsopt variable if you do not want to use the /bin/mail command. If you do not use /bin/mail, you cannot use the -h, -r, or -U options.
allnet False by default (noallnet). Causes mailx to match all messages with the same login name as identical. This ignores the network address part of the message name. For example, the message names

moovax!john
sunup!john

are treated as equal names in a message list.
append False by default (noappend). When true, causes mailx to append messages to the mbox file when you exit from read mode. The default is to insert the messages at the beginning of the mbox file.
askcc False by default (noaskcc). When true, mailx prompts you for a list of users you want to send a Carbon copy (Cc) of the message.
asksub True by default. When true, mailx prompts you for a Subject line when you send a message. If you do not type any text and just press Return, no subject is sent.
autoprint False by default. When true, displays the last affected message automatically after you have used the delete or undelete command.
bang False by default. When true, exclamation marks (!) used in shell escape commands are interpreted the same as in vi.
cmd=cmd No default. Sets the cmd variable to the UNIX command cmd. A common cmd might be "lp -dlaser."
conv=conversion Sets the method used to convert address formats. The only conversion supported at this time is internet, which converts uucp addresses to internet addresses. The uucp address format is system!user. The internet format is user@system. The internet format requires a mail delivery program to conform to the RFC822 standard for electronic mail addressing.
crt=number If set to a number, causes messages containing more than number lines to be piped through the command defined by the PAGER variable. The PAGER variable is set to pg by default.
DEAD=file Partial messages from when mailx was interrupted and undeliverable messages are stored in the specified file. The default file is dead.letter.
debug False by default. When true, causes mailx to display verbose diagnostic messages for debugging. No messages are delivered if the debug variable is set.
dot False by default. When true, causes a line beginning with a single dot (.) to terminate input when you are entering a message to be mailed.
EDITOR=cmd Defines which editor is invoked when you use the tilde escape command ~e or the command mode command edit. The default value is ed.
escape=c Sets the tilde escape character to character c. The default value of c is ~ (tilde). For example, if you set escape=%, then you would type %v to invoke the visual editor instead of ~v.
folder=directory Defines which directory is used for saving mail files. To have files saved to this directory you must precede them with a + (plus sign). Suppose you have set folder=mail. Then you issue the following command,

s +proj1

which saves the current message to the file named proj1 in the folder directory $HOME/mail ($HOME/mail/proj1). The directory name is assumed to be relative from your $HOME directory unless you begin it with a /. For example, folder=mail sets the directory to $HOME/mail. But folder=/tmp, sets the directory to /tmp.
If you want to reference files in your folder directory from the UNIX command line, you must define a shell variable. For example,

export folder=mail

sets the shell variable folder to mail. This must be done to perform commands such as

mailx -f +proj1

No default value exists for folder.

header True by default. When true, causes the first page of header lines to be displayed when you start mailx in read mode.
hold False by default. Saves messages you have touched (read) in your mailbox (/usr/mail/mylogin) instead of your mbox file.
ignore False by default. When true, causes mailx to ignore interrupt signals while in insert mode. This prevents mailx from saving the partial message to the dead.letter file and then aborting. It comes in handy when you are dialed in on a noisy line. A noisy phone line generates strange characters because of noise interference. It is not uncommon for these characters to be Breaks and Interrupts.
ignoreeof False by default. When true, the end-of-file signal (Ctrl-D) is ignored during input mode. This is also handy for noisy dial-up lines. If you do set this variable to true, you must either use the ~. command or set the dot variable and use a single . to terminate input.
keep False by default. When true, your mailbox (/usr/mail/mylogin) is kept even when empty. Normally, your mailbox is removed if it becomes empty.
keepsave False by default. When set, a copy of a message is kept in your mailbox (/usr/mail/mylogin) even if you have saved the message to another file.
LISTER=cmd Defines the UNIX command cmd to be used when you use the folders command to list files in the folder directory. The default cmd command is ls. You might want to try setting LISTER="ls -x".
MBOX=file Specifies the file to save messages that have been touched (read) when you quit mailx. If you save files while in mailx, this variable is ignored. If you exit via the xit command, messages are not saved to the MBOX file. The default value of MBOX is $HOME/mbox.
metoo False by default. If false, your name is removed from the list of recipients when you use the reply command. If true, your name is left in the list of recipients. Thus you receive a copy of the reply message.
onehop False by default. When true, the reply command does not adjust return addresses based on the address of the first recipient. Instead, the reply message is sent to systems only one hop away. For example, let's say sunrise!tina sends mail to moovax!nancy and sunup!bill. If bill replies (using the reply command), his reply message is sent to sunrise!tina and sunrise!moovax!nancy. If onehop is set, then the replies are sent to sunrise!tina and moovax!nancy. You should only set onehop if you are on a local network where all systems can communicate with each other directly.
outfolder False by default. When true, all messages saved with the Save, Copy, followup, and Followup commands are stored in the folder directory. The record variable must be set. If you specify an absolute path (a path beginning with a /), this variable is ignored.
page False by default. When true, causes a form-feed character to be inserted between each message passed to a pipe command.
PAGER=cmd Defines the UNIX command cmd to be used for paging through messages if the crt variable is set. The default cmd is pg.
prompt="str" Defines the command mode prompt to be str. The default prompt is set to a ? (question mark blank).
quiet False by default. When true, the beginning mailx message and version information is suppressed.
record=file False by default. When set, causes all outgoing messages to be saved in file.
save True by default. Causes messages that were interrupted to be saved in the dead.letter file. Refer to the DEAD variable.
screen=number Defines the number of lines to be displayed by the header command.
sendmail=cmd Defines the command used to send (deliver) mail. The default is mail. Most users don't worry with this variable.
sendwait False by default. If true, mailx does not place a process in background when sending mail. Instead, your message is sent in the foreground. Control of your terminal is returned to you when the mail message has been delivered. May cause mailx to be extremely slow, depending on your system and the address resolution required.
SHELL=cmd Defines the UNIX command to run when you use the ! or ~! commands. The default value is sh.
showto False by default. When true, this variable causes the name of the recipient to be displayed in the header line instead of the sender. For example, if you send a message to Bill and a carbon copy to yourself, the message header will display your name because you're the sender. But if you set showto, then Bill's name would be displayed in the header line.
sign=str Contains the string str that is inserted into your message when you use the ~a command. Contains no default value. Common use is to assign a signature or header to the variable.
Sign=str Contains the string str that is inserted into your message when you use the ~A command. This variable contains no default value. Also used for signature or header type strings.
toplines=number Defines the number of lines the top command uses. The default value is 5.
VISUAL=cmd Defines the screen editor to use when you use the visual or ~v command. The default value is vi.

BSD (Berkeley)
The BSD mail program does not support the following variables.
allnet outfolder
asksub page
autoprint prompt
bang save
cmd screen
conv sendmail
DEAD sendwait
header showto
keep sign
keepsave Sign
onehop SMARTMAILER
The BSD mail does, however, support the following variables that are not supported under System V mailx.
ask Same as System V asksub variable
nosave Same as System V save variable
verbose Same as the -v option. The actual delivery of mail is performed in foreground and displayed on your screen, much like the sendwait variable in System V.


Previous Table of Contents Next