Next: , Previous: command line, Up: Programs


3.2 Mailutils Configuration File

Configuration files are the principal means of configuring any GNU Mailutils component. When started, each utility tries to load its configuration from the following locations, in that order:

  1. Main site-wide configuration file.

    It is named sysconfdir/mailutils.rc, where sysconfdir stands for the system configuration directory set when compiling the package. You can obtain the value of sysconfdir by running

              $ mailutils-config --info sysconfdir
    

    or

              $ prog --show-config-options | grep SYSCONFDIR
    

    where prog stands for any GNU Mailutils utility.

    The site-wide configuration file is not read if the --no-site-config command line option was given.

  2. Per-user configuration file.

    A per user configuration file is located in the user home directory and is named ‘.prog’, where prog is the name of the utility. For example, the per-user configuration file for sieve utility is named .sieve.

    This configuration file is not read if the --no-user-config command line option was given.

  3. Additional configuration file, if specified using the --config-file command line option.

The order in which configuration files are loaded defines the precedence of their settings. Thus, the settings from additional configuration file override those set in per-user configuration file. The latter, in their turn, take precedence over the settings from the site-wide configuration file.

Neither site-wide nor user configuration files are required to exist. If any or both of them are absent, GNU Mailutils does not complain, and the utility falls back to its default settings. To make configuration processing more verbose, use the --config-verbose command line option. Here is an example of what you might get using this option:

     imap4d: Info: parsing file `/etc/mailutils.rc'
     imap4d: Info: finished parsing file `/etc/mailutils.rc'

Specifying this option more than once adds more verbosity to this output. If this option is given two times, GNU Mailutils will print any configuration file statement it parsed, along with the exact location where it occurred (the exact meaning of each statement will be described later in this chapter):

     imap4d: Info: parsing file `/etc/mailutils.rc'
     # 1 "/etc/mailutils.rc"
     mailbox {
     # 2 "/etc/mailutils.rc"
       mailbox-pattern maildir:/var/spool/mail;type=index;param=2;user=${user};
     # 3 "/etc/mailutils.rc"
       mailbox-type maildir;
     };
     # 6 "/etc/mailutils.rc"
     include /etc/mailutils.d;
     imap4d: Info: parsing file `/etc/mailutils.d/imap4d'
     ...

To test configuration file without actually starting the utility, use the --config-lint command line option. With this option, any Mailutils utility exits after finishing parsing of the configuration files. Any errors occurred during parsing are displayed on the standard error output. This option can be combined with --config-verbose to obtain more detailed output.

The --config-help command line option produces on the standard output the summary of all configuration statements understood by the utility, with detailed comments and in the form suitable for configuration file. For example, the simplest way to write a configuration file for, say, imap4d is to run

     $ imap4d --config-help > imap4d.rc

and to edit the imap4d.rc file with your editor of choice.

It is also possible to set or override arbitrary configuration variables in the command line. It can be done via the --set option. Its argument is a pathname of the variable to be set. For example, to define the variable ‘syslog’ in section ‘logging’ to ‘no’, do the following:

     $ imap4d --set .logging.syslog=no

Configuration pathnames are discussed in detail in Paths.