|
GNU Mailutils |
General-Purpose Mail Package |
Official GNU Software |
| GNU Mailutils Manual (split by section): | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
? |
mail — Send and Receive Mail Mail is an enhanced version of standard /bin/mail program.
As well as its predecessor, it can be used either in sending mode or
in reading mode. Mail enters sending mode when one or more
email addresses were specified in this command line. In this mode the
program waits until user finishes composing the message, then attempts
to send it to the specified addresses and exits.
See Composing Mail, for a detailed description of this behavior.
If the command line contained no email addresses, mail switches
to reading mode. In this mode it allows to read and manipulate the
contents of the user system mailbox. The ‘--file’ (‘-f’)
command line option allows to specify another mailbox name. For more
detail, see Reading Mail.
In contrast to other GNU Mailutils programs, mail does not
use the Mailutils configuration file. Instead, it uses the traditional
‘mailrc’-style configuration. See section Personal and System-wide Configuration Files,
for a detailed description of its format.
mail General usage of mail program is:
mail [option...] [address...] |
If [address...] part is present, mail switches to
mail sending mode, otherwise it operates in mail reading mode.
The program uses following option groups: .
Mail understands following command line options:
Return true if the mailbox contains some messages. Return false otherwise. This is useful for writing shell scripts.
Execute command before opening the mailbox. Any number of ‘--exec’ options can be given. The commands will be executed after sourcing configuration files (see section Personal and System-wide Configuration Files), but before opening the mailbox.
Operate on the mailbox given by the first non-optional command line argument. If there is no such argument, read messages from the user's ‘mbox’ file. See section Reading Mail, for more details about using this option.
Record outgoing messages in a file named after the first recipient. The name is the login-name portion of the address found first on the ‘To:’ line in the mail header. This option sets the ‘byname’ variable, which see (see byname).
Print header summary to stdout and exit.
Ignore interrupts.
Set path to the mailspool directory
Do not read the system-wide mailrc file. See section Personal and System-wide Configuration Files.
Do not display initial header summary.
Print all mail to standard output. It is equivalent to issuing following commands after starting ‘mail -N’:
print * quit |
Cause interrupts to terminate program.
Send a message with a Subject of subj. Valid only in sending mode.
Switch to sending mode.
Operate on user's mailbox. This is equivalent to:
mail -f/spool_path/user |
with spool_path being the full path to your mailspool directory
(‘/var/spool/mail’ or ‘/var/mail’ on most systems).
Display a help message.
Display a short usage summary.
Print program version and exit.
Many mail commands such as print and delete can be given a message list to operate upon. Wherever the message list is omitted, the command operates on the current message.
The message list in its simplest form is one of:
Selects current message. It is equivalent to empty message list.
Selects all messages in the mailbox.
Selects first non-deleted message.
Selects last non-deleted message.
In its complex form, the message list is a comma or whitespace-separated list of message specifiers. A message specifier is one of
This specifier addresses the message with the given ordinal number in the mailbox.
Message range is specified as two message numbers separated by a dash. It selects all messages with the number lying within that range.
An Attribute specifier is a colon followed by a single letter. The Attribute specifier addresses all messages in the mailbox that have the given attribute. These are the valid attribute specifiers:
Selects all deleted messages.
Selects all recent messages, i.e. the messages that have not been neither read not seen so far.
Selects all messages that have been seen.
Selects all messages that have been read.
Selects all messages that have not been read.
Selects all tagged messages.
Selects all untagged messages.
The header match is a string in the form:
[header:]/string/ |
It selects all messages that contain header field header
matching given regexp. If the variable regexp is set,
the string is assumed to be a POSIX regexp. Otherwise, a
header is considered to match string if the latter constitutes
a substring of the former (comparison is case-insensitive).
If header: part is omitted, it is assumed to be ‘Subject:’.
The message body match is a string in the form:
:/string/ |
It selects all messages whose body matches the string. The matching rules are the same as described under “Header match”.
A message specifier can be followed by message part specifier, enclosed in a pair of brackets. A message part specifier controls which part of a message should be operated upon. It is meaningful only for multipart messages. A message part specifier is a comma or whitespace - separated list of part numbers or ranges. Each part number can in turn be message part specifier, thus allowing for operating upon multiply-encoded messages.
The following are the examples of valid message lists:
You can compose the message by simply typing the contents of it, line
by line. But usually this is not enough, you would need to edit
your text, to quote some messages, etc. Mail provides these
capabilities through compose escapes. The compose escapes
are single-character commands, preceded by special escape character,
which defaults to ‘~’. The combination escape character + command
is recognized as a compose escape only if it occurs at the beginning of
a line. If the escape character must appear at the beginning of a
line, enter it twice.
The actual escape character may be changed by setting the value of
escape mail variable (see section How to Alter the Behavior of mail).
There are several commands allowing you to quit the compose mode.
Typing the end-of-file character (‘C-D’) on a line alone finishes
compose mode and sends the message to its destination. The ‘C-D’
character looses its special meaning if ignoreeof mail variable
is set.
If mail variable dot is set, typing dot (‘.’) on a line
alone achieves the same effect as ‘C-D’ above.
Finally, using ‘~.’ escape always quits compose mode and sends out the composed message.
To abort composing of a message without sending it, type interrupt
character (by default, ‘C-C’) twice. This behavior is disabled
when mail variable ignore is set. In this case, you can use
‘~x’ escape to achieve the same effect.
The ‘~?’ escape prints on screen a brief summary of the available compose escapes. Please note, that ‘~h’ escape prompts for changing the header values, and does not give help.
If you are not satisfied with the message as it is, you can edit it
using a text editor specified either by EDITOR or by
VISUAL environment variables. The ‘~e’ uses the former,
and ‘~v’ uses the latter.
By default both escapes allow you to edit only the body of the
message. However, if the editheaders variable is set,
mail will load into the editor the complete text of
the message with headers included, thus allowing you to change
the headers as well.
To add new addresses to the list of message recipients, use ‘~t’ command, e.g.:
~t name1@domain.net name2 |
To add addresses to Cc or Bcc, use ‘~c’ or ‘~b’
escapes respectively.
To change the Subject header, use ‘~s’ escape, e.g.:
~s "Re: your message" |
Finally, to edit all headers, type ‘~h’ escape. This will present
you with the values of To, Cc, Bcc, and
Subject headers allowing to edit them with normal text editing
commands.
If you are sending mail from within mail command mode, you can enclose the contents of any message sent to you by using ‘~m’ or ‘~M’ commands. Typing ‘~m’ alone will enclose the contents of the current message, typing ‘~m 12’ will enclose the contents of message #12 and so on.
The ‘~m’ uses retained and ignored lists when enclosing headers, the ‘~M’ encloses all header fields.
In both cases, the contents of indentprefix mail variable is
prepended to each line enclosed.
To append the contents of file filename to the message, type
~r filename |
or
~< filename |
The ‘~d’ escape is a shorthand for
~r dead.letter |
The ‘~p’ escape types the contents of the message entered so far, including headers, on your terminal. You can save the message to an arbitrary file using ‘~w’ escape. It takes the filename as its argument.
To save you the effort of typing your signature at the end of each
message, you can use ‘~a’ or ‘~A’ escapes. If your signature
occupies one line only, save it to the variable sign and use
‘~a’ escape to insert it. Otherwise, if it is longer than one
line, save it to a file, store the name of this file in the
variable Sign, and use ‘~A’ escape to insert it into
the message.
Sometimes it is necessary to view the contents of another message, while composing. These two escapes allow it. Both take the message list as their argument. If they are used without argument, the contents of the current message is printed. The difference between ‘~f’ and ‘~F’ is that the former uses ignored and retained lists to select headers to be displayed, whereas the latter prints all headers.
The ‘~i’ escape enters the value of the named mail variable into the body of the message being composed.
You can execute a mail command from within compose mode using ‘~:’ or ‘~-’ escapes. For example, typing
~: from :t |
will display the from lines of all tagged messages. Note, that executing
mail-sending commands from within the compose mode is not allowed.
An attempt to execute such a command will result in diagnostic message
“Command not allowed in an escape sequence” being displayed.
Also, when starting compose mode immediately from the shell
(e.g. running ‘mail address@domain’), most mail commands are
meaningless, since there is no mailbox to operate upon. In this case,
the only commands that can reasonably be used are: alias,
unalias, alternate, set, and unset.
The ‘~!’ escape executes specified command and returns you to
mail compose mode without altering your message. When used without
arguments, it starts your login shell. The ‘~|’ escape pipes the
message composed so far through the given shell command and replaces the
message with the output the command produced. If the command produced
no output, mail assumes that something went wrong and retains
the old contents of your message.
To read messages from a given mailbox, use one of the following ways of
invoking mail:
mailTo read messages from your system mailbox.
mail -fmail --fileTo read messages from your mailbox (‘$HOME/mbox’). If the ‘--user’ option (see below) is also given, read messages from that user's ‘mbox’.
mail -f path_to_mailboxmail --file path_to_mailboxTo read messages from the specified mailbox.
mail -u usermail --user=userTo read messages from the system mailbox belonging to user.
Please note, that usual mailbox permissions won't allow you to use the last variant of invocation, unless you are a super-user. Similarly, the last but one variant is also greatly affected by the permissions the target mailbox has.
Notice that path_to_mailbox is not an argument to ‘--file’ (‘-f’) option, but rather the first non-optional argument on the command line. Therefore, the following three invocations are equivalent:
$ mail -fin mymbox $ mail -f mymbox -in $ mail --file -in mymbox $ mail --file -i mymbox -n |
Additionally, for conformance to the GNU standards, the following form is also accepted:
$ mail --file=mymbox -i -n |
Unless you have started mail with ‘--norc’ command line option,
it will read the contents of the system-wide configuration file.
Then it reads the contents of user configuration file, if any.
For detailed description of these files, see Personal and System-wide Configuration Files.
After this initial setup, mail displays the first page of header
lines and enters interactive mode. In interactive mode, mail
displays its prompt (‘?’, if not set otherwise) and executes the
commands the user enters.
Following commands quit the program:
Terminates the session. If mail was operating upon user's system
mailbox, then all undeleted and unsaved messages that have been read and
are not marked with hold flag are saved to the user's mbox file
(‘$HOME/mbox’). The messages, marked with delete are removed.
The program exits to the Shell, unless saving the mailbox fails, in
which case user can escape with the exit command.
Program exits to the Shell without modifying the mailbox it operates upon.
Typing EOF (‘C-D’) alone is equivalent to ‘quit’.
Following commands can be used during the session to request online help:
Display detailed command synopsis. If no command is given, help for all available commands is displayed.
Print a list of available commands.
Display program version.
Display program warranty statement.
Move to the first undeleted message.
Move to the last undeleted message.
Move to the next message.
Move to the previous message.
Change to the specified directory. If dir is omitted, $HOME is
assumed.
Read in the contents of the specified mailbox. The current mailbox
is updated as if quit command has been issued.
If mailbox is omitted, the command prints the current mailbox
name followed by the summary information regarding it, e.g.:
|
To control which headers in the message should be displayed, mail
keeps two lists: a retained header list and an ignored
header list. If retained header list is not empty, only the
header fields listed in it are displayed when printing the message.
Otherwise, if ignored header list is not empty, only the headers
not listed in this list are displayed. The uppercase variants
of message-displaying commands can be used to print all the headers.
The following commands modify and display the contents of both lists.
Add header-field-list to the ignored list. When used without arguments, this command prints the contents of ignored list.
Add header-field-list to the retained list. When used without arguments, this command prints the contents of retained list.
Displays the current message number.
Lists the current pageful of headers.
Lists the contents of ‘From’ headers for a given set of messages.
Presents message headers in pagefuls as described for headers
command. When arg is ‘.’, it is generally equivalent to
headers. When arg is omitted or is ‘+’, the next
pageful of headers is displayed. If arg is ‘-’, the
previous pageful of headers is displayed. The latter two forms
of z command may also take a numerical argument meaning the
number of pages to skip before displaying the headers. For
example:
& z +2 |
will skip two pages of messages before displaying the header summary.
Lists the message number and message size in bytes for each message in msglist.
Displays the value of folder variable.
Displays current mailbox summary. E.g.:
|
Prints out the messages from msglist. The variable crt
determines the minimum number of lines the body of the message must
contain in order to be piped through pager command specified
by environment variable PAGER. If crt is set to a numeric
value, this value is taken as the minimum number of lines. Otherwise,
if crt is set without a value then the height of the terminal
screen is used to compute the threshold. The number of lines on
screen is controlled by screen variable.
Like print but also prints out ignored header fields.
Print a multipart message. The decode command decodes and prints
out specified message parts. E.g.
|
Prints the top few lines of each message in msglist. The number
of lines printed is controlled by the variable toplines and
defaults to five.
Pipe the contents of specified messages through shell-command. If
shell-command is empty but the string variable cmd is set,
the value of this variable is used as a command name.
Prints the MIME structure of each message from msglist. Empty msglist means current message.
Example:
|
Tag messages. The tagged messages can be referred to in message list using ‘:t’ notation.
Clear tags from specified messages. To untag all messages tagged so far type
& untag :t |
Marks each message to be held in user's system mailbox. This command
does not override the effect of delete command.
Mark messages as deleted. Upon exiting with quit command these
messages will be deleted from the mailbox. Until the end of current
session the deleted messages can be referred to in message lists using
:d notation.
Clear delete mark from the specified messages.
Deletes the current message and prints the next message. If msglist is specified, deletes all messages from the list and prints the message, immediately following last deleted one.
Takes a message list and a file name and appends each message in turn to
the end of the file. The name of file and number of characters appended
to it is echoed on the terminal. Each saved message is marked for
deletion as if with delete command, unless the variable
keepsave is set.
Like save, but the file to append messages to is named after the
sender of the first message in msglist. For example:
|
i.e., 22 lines (603 characters) have been appended to the file “smith”. If the file does not exist, it is created.
Similar to save, except that only message body (without the
header) is saved.
Similar to Save, except that only message body (without the
header) is saved.
Mark list of messages to be saved in the user's mailbox (‘$HOME/mbox’)
upon exiting via quit command. This is the default action for
all read messages, unless you have variable hold set.
Similar to save, except that saved messages are not marked for
deletion.
Similar to Save, except that saved messages are not marked for
deletion.
These command allow to edit messages in a mailbox. Please note,
that modified messages currently do not replace original ones. i.e.
you have to save them explicitly using your editor's save
command if you do not want the effects of your editing to be lost.
Edits each message in msglist with the editor, specified in
EDITOR environment variable.
Edits each message in msglist with the editor, specified in
VISUAL environment variable.
With no arguments, prints out all currently-defined aliases. With one argument, prints out that alias. With more than one argument, creates a new alias or changes an old one.
Takes a list of names defined by alias commands and discards the remembered groups of users. The alias names no longer have any significance.
The alternates command is useful if you have accounts on several machines. It can be used to inform mail that the listed addresses are really you. When you reply to messages, mail will not send a copy of the message to any of the addresses listed on the alternates list. If the alternates command is given with no argument, the current set of alternate names is displayed.
Switches to compose mode. After composing the message, sends messages to the specified addresses.
For each message in msglist, switches to compose mode and sends the composed message to the sender and all recipients of the message.
Like reply, except that the composed message is sent only to
originators of the specified messages.
Notice, that setting mail variable flipr (see section How to Alter the Behavior of mail) swaps the meanings of the two above commands,
so that reply sends the message to the sender and all
recipients of the message, whereas Reply sends it to
originators only.
Switches to compose mode. After composing, sends the message to the originators and recipients of all messages in msglist.
Similar to followup, but reply message is sent only to
originators of messages in msglist.
To determine the sender of the message mail uses the
list of sender fields (see Controlling Sender Fields). The first field
from this list is looked up in message headers. If it is found
and contains a valid email address, this address is used as
the sender address. If not, the second field is searched and
so on. This process continues until a field is found in the
headers, or the sender field list is exhausted, whichever happens
first.
If the previous step did not determine the sender address, the address from SMTP envelope is used.
Let's illustrate this. Suppose your mailbox contains the following:
|
Now, you issue the following commands:
|
As you see, the value of Reply-To field was taken as the
sender address.
Now, let's try the following command sequence:
# Clear the sender list & nosender # Set new sender list & sender From |
Now, the From address will be taken:
|
Commands sender and nosender are used to manipulate
the contents of the sender field list.
If the command sender is used without arguments, it displays
the contents of the sender field list. If arguments are given,
each argument is appended to the sender field list. For example:
|
Command nosender is used to remove items from the sender
field list:
|
When used without arguments, this command clears the list:
|
The incorporate (inc) command incorporates newly arrived
messages to the displayed list of messages. This is done automatically
before returning to mail command prompt if the variable
autoinc is set.
To run arbitrary shell command from mail command prompt, use
shell (sh) command. If no arguments are specified, the
command starts the user login shell. Otherwise, it uses its first
argument as a file name to execute and all subsequent arguments are
passed as positional parameters to this command. The shell
command can also be spelled as !.
The ‘#’ character introduces an end-of-line comment. All characters until and including the end of line are ignored.
The ‘echo’ (‘ec’) command prints its arguments to stdout.
The command ‘source filename’ reads commands from the named file. Its minimal abbreviation is ‘so’.
The mail variables are set using ‘set’ (‘se’) command. The command takes a list of assignments. The syntax of an assignment is
Assign a string value to the variable. If string contains whitespace characters it must be enclosed in a pair of double-quote characters (‘"’)
Assign a numeric value to the variable.
Assign boolean True value.
Assign boolean False value.
Example:
& set askcc nocrt indentprefix="> " |
This statement sets askcc to True, crt to
False, and indentprefix to “> ”.
To unset mail variables use ‘unset’(‘uns’) command. The command takes a list of variable names to unset.
Example: To undo the effect of the previous example, do:
& unset askcc crt indentprefix |
When used without arguments, both set or unset
list all currently defined variables. The form of this listing is
controlled by variable-pretty-print (varpp) variable. If
it is set, a description precedes each variable, e.g.:
# prompt user for subject before composing the message ask # prompt user for cc before composing the message askcc # output character set for decoded header fields charset="auto" # number of columns on terminal screen columns=80 |
If variable-pretty-print is not set, only the settings are
shown, e.g.:
ask askcc charset="auto" columns=80 |
A special command is provided to list all internal mail
variables:
variable [names...] |
If used without arguments, it prints all known internal variables. If arguments are given, it displays only those internal variables that are listed in command line. For each variable, this command prints its name, data type, current value and a short description. For example:
& variable ask datefield ask, asksub Type: boolean Current value: yes prompt user for subject before composing the message datefield Type: boolean Current value: [not set] get date from the `Date:' header, instead of the envelope |
Shell environment may be modified using ‘setenv’ (‘sete’) command. The command takes a list of assignments. The syntax of an assignment is:
If variable name does not already exist in the environment, then it is added to the environment with the value value. If name does exist, then its value in the environment is changed to value.
Delete the variable name from the environment (“unset” it).
The conditional statement allows to execute a set of mail commands
depending on the mode the mail program is in. The conditional
statement is:
if cond ... else ... endif |
where ‘...’ represents the set of commands to be executed in each branch of the statement. cond can be one of the following:
True if mail is operating in mail sending mode.
True if mail is operating in mail reading mode.
True if stdout is a terminal device (as opposed to a regular file).
The conditional statements can be nested to arbitrary depth. The minimal abbreviations for ‘if’, ‘else’ and ‘endif’ commands are ‘i’, ‘el’ and ‘en’.
Example:
if t set crt prompt="& " else unset prompt endif if s alt gray@farlep.net gray@mirddin.farlep.net set |
mail Following variables control the behavior of GNU mail:
appendType: Boolean, Read-Only
Default: True
Messages saved in mbox are appended to the end rather than prepended.
This is the default and cannot be changed. This variable exists only
for compatibility with other mailx implementations.
appenddeadletterType: Boolean.
Default: False.
If this variable is True, the contents of canceled letter is
appended to the user's ‘dead.letter’ file. Otherwise it overwrites
its contents.
askbccType: Boolean.
Default: False.
When set to True the user will be prompted to enter Bcc
field before composing the message.
askccWhen set to True the user will be prompted to enter Cc
field before composing the message.
asksubType: Boolean.
Default: True in interactive mode, False otherwise.
When set to True the user will be prompted to enter Subject
field before composing the message.
autoincAutomatically incorporate newly arrived messages.
autoprintType: Boolean.
Default: False.
Causes the delete command to behave like dp - thus, after deleting a message, the next one will be typed automatically.
bangType: Boolean.
Default: False.
When set, every occurrence of ! in arguments to !
command is replaced with the last executed command.
bynameRecord outgoing messages in a file named after the first recipient. The name is the login-name portion of the address found first on the ‘To:’ line in the mail header. This variable overrides the ‘record’ variable.
It is set by the ‘--byname’ (‘-F’) command line option.
datefieldType: Boolean.
Default: False.
By default the date in a header summary is taken from the SMTP
envelope of the message. Setting this variable tells mail
to use the date from Date: header field, converted to
local time. Notice, that for messages lacking this field mail
will fall back to using SMTP envelope.
See fromfield.
charsetThe value of this variable controls the output character set for the
header fields encoding using RFC 2047. If the variable is unset, no
decoding is performed and the fields are printed as they are. If the
variable is set to ‘auto’, mail tries to deduce the
name of the character set from the value of LC_ALL environment
variable. Otherwise, its value is taken as the name of the charset.
cmdContains default shell command for pipe.
columnsType: Numeric.
Default: Detected at startup by querying the terminal device. If this
fails, the value of environment variable COLUMNS is used.
This variable contains the number of columns on terminal screen.
crtType: Boolean or Numeric
Default: True in interactive mode, False otherwise.
The variable crt determines the minimum number of lines the body
of the message must contain in order to be piped through pager command
specified by environment variable PAGER. If crt is set
to a numeric value, this value is taken as the threshold. Otherwise,
if crt is set without a value, then the height of the terminal
screen is used to compute the threshold. The number of lines on
screen is controlled by screen variable.
debugType: String to boolean
Default: Not set
Sets mailutils debug level. If set to string, the value must be a valid Mailutils debugging specification. See section Debug Statement, for a description.
If unset (i.e. set nodebug), clears and disables all debugging
information. If set to ‘true’ (i.e. set debug), sets
maximum debugging (‘<trace7’) on mailbox and its underlying
objects.
decode-fallbackType: String.
Default: ‘none’.
This variable controls the way to represent characters that cannot be rendered using current character set. It can have three values:
Such characters are not printed at all. The conversion process stops at the first character that cannot be rendered.
The characters are displayed ‘as is’. Notice, that depending on your setup, this may screw-up your terminal settings.
Unprintable characters are represented by their octal codes. Printable ones are printed ‘as is’.
debugThis variable is not used. It exists for compatibility with other
mailx implementations and for future use.
dotType: Boolean.
Default: False.
If True, causes mail to interpret a period alone on a line as the
terminator of a message you are sending.
emptystartType: Boolean.
Default: False.
If the mailbox is empty, mail normally prints ‘No mail for user’ and
exits immediately. If this option is set, mail will start no matter is
the mailbox empty or not.
editheadersType: Boolean.
Default: False.
When set, mail will include message headers in the text to
be the ~e and ~v escapes, thus allowing you to customize
the headers.
escapeIf defined, the first character of this option gives the character to denoting escapes.
fliprIf set, the variable flipr swaps the meanings of reply
and Reply commands (see Replying).
folderThe name of the directory to use for storing folders of messages. If
unset, $HOME is assumed.
fromfieldType: Boolean.
Default: True.
By default the sender address is taken from the ‘From’ header.
Unsetting this variable tells mail to obtain it from the
SMTP envelope, instead.
See datefield.
headerType: Boolean.
Default: True, unless started with ‘--nosum’ (‘-N’) option.
Whether to run headers command automatically after entering
interactive mode.
headlineType: String
Default: ‘%>%a%4m %18f %16d %3l/%-5o %s’
A format string to use for the header summary. The ‘%’ character introduces a format specifier. Valid format specifiers are:
| Letter | Meaning |
|---|---|
| %a | Message attributes. |
| %d | The date when the message was received. |
| %f | The address of the message sender. |
| %l | The number of lines of the message. |
| %m | Message number. |
| %o | The number of octets (bytes) in the message. |
| %s | Message subject (if any). |
| %S | Message subject (if any) in double quotes. |
| %> | A ‘>’ for the current message, otherwise a space. |
| %< | A ‘<’ for the current message, otherwise a space. |
| %% | A `%' character. |
Some additional symbols are allowed between ‘%’ and the specifier letter. The ‘-’ character immediately following ‘%’ indicates that this field should be left aligned. Similarly, the ‘+’ character indicates right alignment. Default alignment depends on the type of the specifier: the specifiers that produce numeric values (‘%l’, ‘%m’, and ‘%o’) are aligned to the right, whereas the ones producing string values are aligned to the left.
A number following ‘%’ or the alignment flag, indicates the field width. Consider, for example, the following specifiers:
Print current message number. Take as much screen columns as necessary to output it.
Print current message number. Occupy 4 screen columns, truncate the output if it does not fit that width. Align the output to the right.
Same as above, but align to the left.
holdType: Boolean.
Default: False.
When set to True, the read or saved messages will be stored in
user's mailbox (‘$HOME/mbox’). Otherwise, they will be held in
system mailbox also. This option is in effect only when operating
upon user's system mailbox.
ignoreType: Boolean.
Default: False.
When set to True, mail will ignore keyboard interrupts
when composing messages. Otherwise an interrupt will be taken as a
signal to abort composing.
ignoreeofType: Boolean.
Default: False.
Controls whether typing EOF character terminates the letter being composed.
indentprefixType: String.
Default: "\t" (a tab character).
String used by the ~m tilde escape for indenting quoted messages.
inplacealiasesType: Boolean
Default: False
If set, mail will expand aliases in the address header field
before entering send mode (see section Composing Mail). By default, the
address header fields are left intact while composing, the alias
expansion takes place immediately before sending message.
keepType: Boolean, Read-Only
Default: True
Truncate the user's system mailbox when it is empty, instead of
removing it. This is the default and cannot be changed. This variable
exists only for compatibility with other mailx implementations.
keepsaveType: Boolean.
Default: False.
Controls whether saved messages should be kept in system mailbox too. This variable is in effect only when operating upon a user's system mailbox.
mailxType: Boolean.
Default: False.
When set, enables mailx compatibility mode. This mode has the following effects:
mail will ask
for Cc and Bcc addresses after composing the body.
The default behavior is to ask for these values before composing
the body.
mail
will exit with zero status. By default it exits with zero status only
if the message was sent successfully.
metamailType: Boolean or String.
Default: True.
This variable controls operation of decode command. If
it is unset, decode will not attempt any interpretation
of the content of message parts. Otherwise, if metamail
is set to true, decode will use internal metamail
support to interpret message parts. Finally, if metamail
is assigned a string, this string is treated as command line of
the external metamail command which will be used to
display parts of a multipart message. For example:
# Disable MIME interpretation: set nometamail # Enable built-in MIME support: set metamail # Use external program to display MIME parts: set metamail="metamail -m mail -p" |
mimenoaskBy default mail asks for confirmation before running
interpreter to view a part of the multi-part message. If this variable
is set, its value is treated as a comma-separated list of MIME types
for which no confirmation is needed. Elements of this list may include
shell-style globbing patterns, e.g. setting
set mimenoask=text/*,image/jpeg |
will disable prompting before displaying any textual files, no matter what their subtype is, and before displaying files with type ‘image/jpeg’.
metooType: Boolean.
Default: False.
Usually, when an alias is expanded that contains the sender, the sender is removed from the expansion. Setting this option causes the sender to be included in the group.
modeType: String, Read-Only
Default: The name of current operation mode.
This variable keeps the name of the current operation mode. Its possible values are:
The program is started with the ‘--headers’ (‘-H’) command
line option (see section Invoking mail).
The program is started with the ‘--exist’ (‘-e’) command
line option (see section Invoking mail).
The program is started with the ‘--print’ (‘-p’) command
line option (see section Invoking mail).
The progran operates in read mode. This is the default.
The program operates in send mode. This means it was given one or more recipient addresses in the command line.
nullbodyControls whether mail accepts messages with an empty
body. The default value, true, means such messages are sent,
and a warning (traditionally saying ‘Null message body; hope
that's ok’) is displayed. The text of the warning can be set using
nullbodymsg variable (see below).
If nullbody is unset, mail will silently ignore such
messages. This can be useful in ‘crontab’ files, to avoid sending
mails when nothing important happens. For example, the ‘crontab’
entry below will send mail only if the utility some-prog
outputs something on its standard output or error:
*/5 * * * * some-prog 2>&1 | \ /bin/mail -E'set nonullbody' -s 'Periodic synchronization' |
showenvelopeType: Boolean
Default: Unset
If this variable is set, the print command will include the
STMP envelope in its output.
nullbodymsgType: String
Default: Null message body; hope that's ok
Keeps the text of the warning, displayed by mail before
sending an empty message. When available, the translation of
this text, in accordance with the current locale, is displayed.
Unsetting this variable disables the warning.
onehopThis variable is not used. It exists for compatibility with other
mailx implementations and for future use.
outfolderContains the directory in which files created by save,
write, etc. commands will be stored. When unset, current
directory is assumed.
pageType: Boolean.
Default: False.
If set to True, the pipe command will emit a linefeed
character after printing each message.
promptContains the command prompt sequence.
quietThis variable is not used. It exists for compatibility with other
mailx implementations and for future use.
quitType: Boolean.
Default: False, unless started with ‘--quit’ (‘-q’) option.
When set, causes keyboard interrupts to terminate the program.
rcType: Boolean.
Default: True, unless started with ‘--norc’ (‘-N’) option.
When this variable is set, mail will read the system-wide
configuration file upon startup. See Personal and System-wide Configuration Files.
readonlyWhen set, mailboxes are opened in readonly mode. In this mode, any
mail commands that alter the contents of the mailbox are
disabled. These commands include, but are not limited to:
delete, save and mbox.
recordWhen set, any outgoing message will be saved to the named file.
recursivealiasesType: Boolean
Default: True
When set, mail will expand aliases recursively.
regexSetting this to True enables use of regular expressions in
‘/.../’ message specifications.
replyprefixSets the prefix that will be used when constructing the subject line of a reply message.
replyregexType: String
Default: ‘^re: *’
Sets the regular expression used to recognize subjects of reply
messages. If the Subject header of the message matches this
expression, the value of replyprefix will not be prepended to
it before replying. The expression should be a POSIX extended regular
expression. The comparison is case-insensitive.
For example, to recognize usual English, Polish, Norwegian and German reply subject styles, use:
set replyregex="^(re|odp|aw|ang)(\\[[0-9]+\\])?:[[:blank:]]" |
(Notice the quoting of backslash characters).
saveWhen set, the aborted messages will be stored in the user's
‘dead.file’. See also appenddeadletter.
screenType: Numeric.
Default: Detected at startup by querying the terminal device. If this
fails, the value of environment variable LINES is used.
This variable contains the number of lines on terminal screen.
sendmailType: String.
Default: sendmail:/usr/lib/sendmail
Contains URL of the mail transport agent.
sendwaitThis variable is not used. It exists for compatibility with other
mailx implementations and for future use.
showtoIf the message was sent by the user, print its recipient address in the header summary.
SignContains the filename holding users signature. The contents of this
file is appended to the end of a message being composed by ~A
escape.
signContains the user's signature. The contents of this variable is appended
to the end of a message being composed by ~a escape. Use
Sign variable, if your signature occupies more than one line.
showtoIf this variable is set, mail will show To: addresses
instead of From: for all messages that come from the user that
invoked the program.
subjectContains default subject line. This will be used when asksub is
off.
toplinesNumber of lines to be displayed by top and Top commands.
variable-strictvarstrictType: Boolean.
Default: False.
Setting this variable enables strict control over variable
settings. In this mode, mail refuses to set read-only
variables. Also, if the user is trying to set an unknown variable,
mail prints a warning.
variable-pretty-printvarppType: Boolean.
Default: False.
If this variable is set, the listing ouput by set contains short
descriptions before each variable. See Setting and Unsetting the Variables.
verboseType: Boolean.
Default: False.
When set, the actual delivery of messages is displayed on the user's terminal.
xmailerControls whether the header ‘X-Mailer’ should be added to outgoing messages. The default value of this header is
X-Mailer: mail (GNU Mailutils 2.2) |
Upon startup, mail reads the contents of the two command files:
the system-wide configuration file, and the user's configuration
file. Each line read from these files is processed like a usual
mail command.
When run with ‘--norc’ (‘-N’) option, mail does
not read the contents of system-wide configuration file. The user's
file, if it exists, is always processed.
The user's configuration file is located in the user's home directory and is named ‘.mailrc’. The location and name of the system-wide configuration file is determined when configuring the package via ‘--with-mail-rc’ option. It defaults to ‘sysconfdir/mail.rc’.
| GNU Mailutils Manual (split by section): | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
? |
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.