![]() |
GNU Mailutils |
General-Purpose Mail Package |
Official GNU Software |
Mail
reads its configuration from several places. First,
it reads the usual Mailutils
configuration files, as
described in Mailutils Configuration File.
The following configuration file statements affect mail
behavior:
Statement | Reference |
---|---|
address | See Sender Address Statements. |
debug | See The debug Statement. |
mailbox | See The mailbox Statement. |
locking | See The locking Statement. |
mailer | See The mailer Statement. |
After processing the usual Mailutils configuration files,
mail
reads two command files prescribed by POSIX:
the system-wide command file, and the user’s command
file. Each line read from these files is processed like a usual
mail
command. As with mailutils configuration files, these
files are not required to exist.
Per-user 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.
Although this setup might seem unnecessarily complicated, it is
based on sound reasons. First of all, since mail
is a part
of GNU mailutils
, it is supposed to use the same settings as
its remaining parts. On the other hand, the mail
utility
is part of POSIX standard, which requires it to read the second pair of
files.
Mail
command files normally consist of several set
statements
(see Setting and Unsetting the Variables), modifying some
variables, discussed in How to Alter the Behavior of mail
. For example:
set hold emptystart editheaders retain from to subject reply-to in-reply-to date alt user@example.org
Certain mail
settings duplicate those of Mailutils. Here is
a list of these:
Mail variable | Mailutils setting |
---|---|
debug | .debug.level |
folder | .mailbox.folder |
sendmail | .mailer.url |
The rule of thumb that helps to decide which setting to use is simple: if the
setting is common for all tools running on that server, place it in the
site-wide Mailutils configuration file. Otherwise, place it in one of
mail
command files.
To trace reading and parsing the Mailutils configuration files, use --config-lint and --config-verbose options. To skip the user configuration file, use the --no-user-config. To skip the system-wide configuration file, use the --no-site-config option. To skip both, use --no-config. See Options That are Common for All Utilities., for details.
To skip reading the system-wide mail
command file, use the
--norc (-N) option. The per-user command file is
~/.mailrc by default. You can instruct mail
to read
another file, by setting the environment variable MAILRC
to the
desired file name. To ignore per-user file altogether, set
MAILRC=/dev/null
.
This document was generated on January 3, 2025 using makeinfo.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.