Chapter 6. Optional Features
Prev |  | Next

## Chapter 6. Optional Features

## 1. General Notes

### 1.1. Enabling/Disabling Features

NeoMutt supports several of optional features which can be enabled or disabled at compile-time by giving the configure script certain arguments. These are listed in the “Optional features” section of the configure --help output.

Which features are enabled or disabled can later be determined from the output of `neomutt -v`. If a compile option starts with “+” it is enabled and disabled if prefixed with “-”. For example, if NeoMutt was compiled using GnuTLS for encrypted communication instead of OpenSSL, `neomutt -v` would contain:

    -openssl +gnutls

### 1.2. URL Syntax

NeoMutt optionally supports the IMAP, POP3 and SMTP protocols which require to access servers using URLs. The canonical syntax for specifying URLs in NeoMutt is (an item enclosed in `[]` means it is optional and may be omitted):

    proto[s]://[username[:password]@]server[:port][/path]

proto is the communication protocol: `imap` for IMAP, `pop` for POP3 and `smtp` for SMTP. If “s” for “secure communication” is appended, NeoMutt will attempt to establish an encrypted communication using SSL or TLS.

Since all protocols supported by NeoMutt support/require authentication, login credentials may be specified in the URL. This has the advantage that multiple IMAP, POP3 or SMTP servers may be specified (which isn't possible using, for example, $imap_user). The username may contain the “@” symbol being used by many mail systems as part of the login name. The special characters “/” (`%2F`), “:” (`%3A`) and “%” (`%25`) have to be URL-encoded in usernames using the `%`-notation.

A password can be given, too but is not recommended if the URL is specified in a configuration file on disk.

If no port number is given, NeoMutt will use the system's default for the given protocol (usually consulting `/etc/services`).

The optional path is only relevant for IMAP and ignored elsewhere.

Example 6.1. URLs

    pops://host/
    imaps://user@host/INBOX/Sent
    smtp://user@host:587/

## 2. SSL/TLS Support

If NeoMutt is compiled with IMAP, POP3 and/or SMTP support, it can also be compiled with support for SSL or TLS using either OpenSSL or GnuTLS (by running the configure script with the --enable-ssl=... option for OpenSSL or --enable-gnutls=... for GnuTLS). NeoMutt can then attempt to encrypt communication with remote servers if these protocols are suffixed with “s” for “secure communication”.

## 3. POP3 Support

NeoMutt has POP3 support and has the ability to work with mailboxes located on a remote POP3 server and fetch mail for local browsing.

Remote POP3 servers can be accessed using URLs with the `pop` protocol for unencrypted and `pops` for encrypted communication, see Section 1.2, “URL Syntax” for details.

Polling for new mail is more expensive over POP3 than locally. For this reason the frequency at which NeoMutt will check for mail remotely can be controlled by the $pop_checkinterval variable, which defaults to every 60 seconds.

POP is read-only which doesn't allow for some features like editing messages or changing flags. However, using Section 7.1, “Header Caching” and Section 7.2, “Body Caching” NeoMutt simulates the new/old/read flags as well as flagged and replied. NeoMutt applies some logic on top of remote messages but cannot change them so that modifications of flags are lost when messages are downloaded from the POP server (either by NeoMutt or other tools).

Another way to access your POP3 mail is the `<fetch-mail>` function (default: G). It allows to connect to $pop_host, fetch all your new mail and place it in the local $spoolfile. After this point, NeoMutt runs exactly as if the mail had always been local.

### Note

If you only need to fetch all messages to a local mailbox you should consider using a specialized program, such as `fetchmail(1)`, `getmail(1)` or similar.

## 4. IMAP Support

NeoMutt has IMAP support and has the ability to work with folders located on a remote IMAP server.

You can access the remote inbox by selecting the folder by its URL (see Section 1.2, “URL Syntax” for details) using the `imap` or `imaps` protocol. Alternatively, a pine-compatible notation is also supported, i.e. `{[username@]imapserver[:port][/ssl]}path/to/folder`

Note that not all servers use “/” as the hierarchy separator. NeoMutt should correctly notice which separator is being used by the server and convert paths accordingly.

When browsing folders on an IMAP server, you can toggle whether to look at only the folders you are subscribed to, or all folders with the toggle-subscribed command. See also the $imap_list_subscribed variable.

Polling for new mail on an IMAP server can cause noticeable delays. So, you'll want to carefully tune the $mail_check and $timeout variables. Reasonable values are:

    set mail_check=90
    set timeout=15

with relatively good results even over slow modem lines.

### Note

Note that if you are using mbox as the mail store on UW servers prior to v12.250, the server has been reported to disconnect a client if another client selects the same folder.

### 4.1. The IMAP Folder Browser

As of version 1.2, NeoMutt supports browsing mailboxes on an IMAP server. This is mostly the same as the local file browser, with the following differences:

- In lieu of file permissions, NeoMutt displays the string “IMAP”, possibly followed by the symbol “+”, indicating that the entry contains both messages and subfolders. On Cyrus-like servers folders will often contain both messages and subfolders.

- For the case where an entry can contain both messages and subfolders, the selection key (bound to `enter` by default) will choose to descend into the subfolder view. If you wish to view the messages in that folder, you must use `view-file` instead (bound to `space` by default).

- You can create, delete and rename mailboxes with the `<create-mailbox>`, `<delete-mailbox>`, and `<rename-mailbox>` commands (default bindings: `C`, `d` and `r`, respectively). You may also `<subscribe>` and `<unsubscribe>` to mailboxes (normally these are bound to `s` and `u`, respectively).

### 4.2. Authentication

NeoMutt supports four authentication methods with IMAP servers: SASL, GSSAPI, CRAM-MD5, and LOGIN. There is also support for the pseudo-protocol ANONYMOUS, which allows you to log in to a public IMAP server without having an account. To use ANONYMOUS, simply make your username blank or “anonymous”.

SASL is a special super-authenticator, which selects among several protocols (including GSSAPI, CRAM-MD5, ANONYMOUS, and DIGEST-MD5) the most secure method available on your host and the server. Using some of these methods (including DIGEST-MD5 and possibly GSSAPI), your entire session will be encrypted and invisible to those teeming network snoops. It is the best option if you have it. To use it, you must have the Cyrus SASL library installed on your system and compile NeoMutt with the --with-sasl flag.

NeoMutt will try whichever methods are compiled in and available on the server, in the following order: SASL, ANONYMOUS, GSSAPI, CRAM-MD5, LOGIN.

There are a few variables which control authentication:

- $imap_user – controls the username under which you request authentication on the IMAP server, for all authenticators. This is overridden by an explicit username in the mailbox path (i.e. by using a mailbox name of the form `{user@host}`).

- $imap_pass – a password which you may preset, used by all authentication methods where a password is needed.

- $imap_authenticators – a colon-delimited list of IMAP authentication methods to try, in the order you wish to try them. If specified, this overrides NeoMutt's default (attempt everything, in the order listed above).

## 5. SMTP Support

Besides supporting traditional mail delivery through a sendmail-compatible program, NeoMutt supports delivery through SMTP.

If the configuration variable $smtp_url is set, NeoMutt will contact the given SMTP server to deliver messages; if it is unset, NeoMutt will use the program specified by $sendmail.

For details on the URL syntax, please see Section 1.2, “URL Syntax”.

The built-in SMTP support supports encryption (the `smtps` protocol using SSL or TLS) as well as SMTP authentication using SASL. The authentication mechanisms for SASL are specified in $smtp_authenticators defaulting to an empty list which makes NeoMutt try all available methods from most-secure to least-secure.

## 6. Managing Multiple Accounts

Usage:

`account-hook` `regex` `command`

If you happen to have accounts on multiple IMAP, POP and/or SMTP servers, you may find managing all the authentication settings inconvenient and error-prone. The account-hook command may help. This hook works like folder-hook but is invoked whenever NeoMutt needs to access a remote mailbox (including inside the folder browser), not just when you open the mailbox. This includes (for example) polling for new mail, storing Fcc messages and saving messages to a folder. As a consequence, account-hook should only be used to set connection-related settings such as passwords or tunnel commands but not settings such as sender address or name (because in general it should be considered unpredictable which account-hook was last used).

Some examples:

    account-hook . 'unset imap_user; unset imap_pass; unset tunnel'
    account-hook imap://host1/ 'set imap_user=me1 imap_pass=foo'
    account-hook imap://host2/ 'set tunnel="ssh host2 /usr/libexec/imapd"'
    account-hook smtp://user@host3/ 'set tunnel="ssh host3 /usr/libexec/smtpd"'

To manage multiple accounts with, for example, different values of $record or sender addresses, folder-hook has to be be used together with the mailboxes command.

Example 6.2. Managing multiple accounts

    mailboxes imap://user@host1/INBOX
    folder-hook imap://user@host1/ 'set folder=imap://host1/ ; set record=+INBOX/Sent'
    mailboxes imap://user@host2/INBOX
    folder-hook imap://user@host2/ 'set folder=imap://host2/ ; set record=+INBOX/Sent'

In example Example 6.2, “Managing multiple accounts” the folders are defined using mailboxes so NeoMutt polls them for new mail. Each folder-hook triggers when one mailbox below each IMAP account is opened and sets $folder to the account's root folder. Next, it sets $record to the INBOX/Sent folder below the newly set $folder. Please notice that the value the “+” mailbox shortcut refers to depends on the current value of $folder and therefore has to be set separately per account. Setting other values like $from or $signature is analogous to setting $record.

## 7. Local Caching

NeoMutt contains two types of local caching: (1) the so-called “header caching” and (2) the so-called “body caching” which are both described in this section.

Header caching is optional as it depends on external libraries, body caching is always enabled if NeoMutt is compiled with POP and/or IMAP support as these use it (body caching requires no external library).

### 7.1. Header Caching

NeoMutt provides optional support for caching message headers for the following types of folders: IMAP, POP, Maildir and MH. Header caching greatly speeds up opening large folders because for remote folders, headers usually only need to be downloaded once. For Maildir and MH, reading the headers from a single file is much faster than looking at possibly thousands of single files (since Maildir and MH use one file per message.)

Header caching can be enabled by configuring one of the database backends. One of tokyocabinet, kyotocabinet, qdbm, gdbm, lmdb or bdb.

If enabled, $header_cache can be used to either point to a file or a directory. If set to point to a file, one database file for all folders will be used (which may result in lower performance), but one file per folder if it points to a directory.

Additionally, $header_cache_backend can be used to specify which backend to use. The list of available backends can be specified at configure time with a set of --with-<backend> options. Currently, the following backends are supported: tokyocabinet, kyotocabinet, qdbm, gdbm, bdb, lmdb.

### 7.2. Body Caching

Both cache methods can be combined using the same directory for storage (and for IMAP/POP even provide meaningful file names) which simplifies manual maintenance tasks.

In addition to caching message headers only, NeoMutt can also cache whole message bodies. This results in faster display of messages for POP and IMAP folders because messages usually have to be downloaded only once.

For configuration, the variable $message_cachedir must point to a directory. There, NeoMutt will create a hierarchy of subdirectories named like the account and mailbox path the cache is for.

### 7.3. Cache Directories

For using both, header and body caching, $header_cache and $message_cachedir can be safely set to the same value.

In a header or body cache directory, NeoMutt creates a directory hierarchy named like: `proto:user@hostname` where `proto` is either “pop” or “imap.” Within there, for each folder, NeoMutt stores messages in single files and header caches in files with the “.hcache” extension. All files can be removed as needed if the consumed disk space becomes an issue as NeoMutt will silently fetch missing items again. Pathnames are always stored in UTF-8 encoding.

For Maildir and MH, the header cache files are named after the MD5 checksum of the path.

### 7.4. Maintenance

NeoMutt does not (yet) support maintenance features for header cache database files so that files have to be removed in case they grow too big. It depends on the database library used for header caching whether disk space freed by removing messages is re-used.

For body caches, NeoMutt can keep the local cache in sync with the remote mailbox if the $message_cache_clean variable is set. Cleaning means to remove messages from the cache which are no longer present in the mailbox which only happens when other mail clients or instances of NeoMutt using a different body cache location delete messages (NeoMutt itself removes deleted messages from the cache when syncing a mailbox). As cleaning can take a noticeable amount of time, it should not be set in general but only occasionally.

## 8. Sending Anonymous Messages via Mixmaster

You may also have compiled NeoMutt to co-operate with Mixmaster, an anonymous remailer. Mixmaster permits you to send your messages anonymously using a chain of remailers. Mixmaster support in NeoMutt is for mixmaster version 2.04 or later.

To use it, you'll have to obey certain restrictions. Most important, you cannot use the `Cc` and `Bcc` headers. To tell NeoMutt to use mixmaster, you have to select a remailer chain, using the mix function on the compose menu.

The chain selection screen is divided into two parts. In the (larger) upper part, you get a list of remailers you may use. In the lower part, you see the currently selected chain of remailers.

You can navigate in the chain using the `<chain-prev>` and `<chain-next>` functions, which are by default bound to the left and right arrows and to the `h` and `l` keys (think vi keyboard bindings). To insert a remailer at the current chain position, use the `<insert>` function. To append a remailer behind the current chain position, use `<select-entry>` or `<append>`. You can also delete entries from the chain, using the corresponding function. Finally, to abandon your changes, leave the menu, or `<accept>` them pressing (by default) the `Return` key.

Note that different remailers do have different capabilities, indicated in the %c entry of the remailer menu lines (see $mix_entry_format). Most important is the “middleman” capability, indicated by a capital “M”: This means that the remailer in question cannot be used as the final element of a chain, but will only forward messages to other mixmaster remailers. For details on the other capabilities, please have a look at the mixmaster documentation.

## 9. Attach Headers Color Feature

### Color attachment headers using regex, just like mail bodies

### 9.1. Support

Since: NeoMutt 2016-09-10

Dependencies: None

### 9.2. Introduction

This feature allows specifying regexes to color attachment headers just like the mail body would. The headers are the parts colored by the `attachment` color. Coloring them is useful to highlight the results of GPGME's signature checks or simply the mimetype or size of the attachment. Only the part matched by the regex is colored.

### 9.3. Usage

The `attach_headers` color should be used just like the `body` color.

    color attach_headers foreground background pattern

### 9.4. neomuttrc

    # Example NeoMutt config file for the attach-headers-color feature.

    # Color if the attachment is autoviewed
    color   attach_headers     brightgreen     default    "Autoview"
    # Color only the brackets around the headers
    color   attach_headers     brightyellow    default    "^\\[--"
    color   attach_headers     brightyellow    default    "--]$"
    # Color the mime type and the size
    color   attach_headers     green           default    "Type: [a-z]+/[a-z0-9\-]+"
    color   attach_headers     green           default    "Size: [0-9\.]+[KM]"
    # Color GPGME signature checks
    color   attach_headers     brightgreen     default    "Good signature from.*"
    color   attach_headers     brightred       default    "Bad signature from.*"
    color   attach_headers     brightred       default    "BAD signature from.*"
    color   attach_headers     brightred       default    "Note: This key has expired!"
    color   attach_headers     brightmagenta   default    "Problem signature from.*"
    color   attach_headers     brightmagenta   default    "WARNING: This key is not certified with a trusted signature!"
    color   attach_headers     brightmagenta   default    "         There is no indication that the signature belongs to the owner."
    color   attach_headers     brightmagenta   default    "can't handle these multiple signatures"
    color   attach_headers     brightmagenta   default    "signature verification suppressed"
    color   attach_headers     brightmagenta   default    "invalid node with packet of type"

    # vim: syntax=neomuttrc

### 9.5. See Also

- Color command

- Regular Expressions

### 9.6. Known Bugs

None

### 9.7. Credits

- Guillaume Brogi `<gui-gui@netcourrier.com>`

## 10. Compose to Sender Feature

### Send new mail to the sender of the current mail

### 10.1. Support

Since: NeoMutt 2016-10-02

Dependencies: None

### 10.2. Introduction

The compose-to-sender feature adds a new command to start composing a new email to the sender of the current message. This is not a reply, but a new, separate, message.

It works on tagged messages too, sending one email to all of the senders of the tagged messages.

### 10.3. Functions

compose-to-sender adds the following function to NeoMutt. By default, it is not bound to a key.

Table 6.1. compose-to-sender Functions

Menus | Function | Description
--- | --- | ---
index,pager | `<compose-to-sender>` | compose a new email to the sender of the current email

### 10.4. neomuttrc

    # Example NeoMutt config file for the compose-to-sender feature.

    # --------------------------------------------------------------------------
    # FUNCTIONS – shown with an example mapping
    # --------------------------------------------------------------------------
    # Compose a new email (not a reply) to the sender
    bind index,pager @ compose-to-sender

    # vim: syntax=neomuttrc

### 10.5. Known Bugs

None

### 10.6. Credits

- Brian Medley

- Guillaume Brogi `<gui-gui@netcourrier.com>`

## 11. Compressed Folders Feature

### Read from/write to compressed mailboxes

### 11.1. Support

Since: NeoMutt 2016-05-30

Dependencies: None

### 11.2. Introduction

The Compressed Folder feature allows NeoMutt to read mailbox files that are compressed. But it isn't limited to compressed files. It works well with encrypted files, too. In fact, if you can create a program/script to convert to and from your format, then NeoMutt can read it.

The feature adds three hooks to NeoMutt: `open-hook`, `close-hook` and `append-hook`. They define commands to: uncompress a file; compress a file; append messages to an already compressed file.

There are some examples of both compressed and encrypted files, later. For now, the documentation will just concentrate on compressed files.

### 11.3. Commands

`open-hook` `regex` `"shell-command"`
`close-hook` `regex` `"shell-command"`
`append-hook` `regex` `"shell-command"`

The shell-command must contain two placeholders for filenames: `%f` and `%t`. These represent “from” and “to” filenames. These placeholders should be placed inside single-quotes to prevent unintended shell expansions.

If you need the exact string “%f” or “%t” in your command, simply double up the “%” character, e.g. “%%f” or “%%t”.

Table 6.2. Not all Hooks are Required

Open | Close | Append | Effect | Useful if
--- | --- | --- | --- | ---
Open | — | — | Folder is readonly | The folder is just a backup
Open | Close | — | Folder is read/write, but the entire folder must be written if anything is changed | Your compression format doesn't support appending
Open | Close | Append | Folder is read/write and emails can be efficiently added to the end | Your compression format supports appending
Open | — | Append | Folder is readonly, but can be appended to | You want to store emails, but never change them

### Note

The command:

- should return a non-zero exit status on failure

- should not delete any files

#### 11.3.1. Read from compressed mailbox

    open-hook regex "shell-command"

If NeoMutt is unable to open a file, it then looks for `open-hook` that matches the filename.

If your compression program doesn't have a well-defined extension, then you can use `.` as the regex.

##### 11.3.1.1. Example of `open-hook`

    open-hook '\.gz$' "gzip --stdout --decompress '%f' > '%t'"

- NeoMutt finds a file, “example.gz”, that it can't read

- NeoMutt has an `open-hook` whose regex matches the filename: `\.gz$`

- NeoMutt uses the command `gzip -cd` to create a temporary file that it can read

#### 11.3.2. Write to a compressed mailbox

    close-hook regex "shell-command"

When NeoMutt has finished with a compressed mail folder, it will look for a matching `close-hook` to recompress the file. This hook is optional.

### Note

If the folder has not been modified, the `close-hook` will not be called.

##### 11.3.2.1. Example of `close-hook`

    close-hook '\.gz$' "gzip --stdout '%t' > '%f'"

- NeoMutt has finished with a folder, “example.gz”, that it opened with `open-hook`

- The folder has been modified

- NeoMutt has a `close-hook` whose regex matches the filename: `\.gz$`

- NeoMutt uses the command `gzip -c` to create a new compressed file

### Note

The `close-hook` can also include extra options, e.g. compression level: `--best`

#### 11.3.3. Append to a compressed mailbox

    append-hook regex "shell-command"

When NeoMutt wants to append an email to a compressed mail folder, it will look for a matching `append-hook`. This hook is optional.

Using the `append-hook` will save time, but NeoMutt won't be able to determine the type of the mail folder inside the compressed file.

NeoMutt will assume the type to be that of the `$mbox_type` variable. NeoMutt also uses this type for temporary files.

NeoMutt will only use the `append-hook` for existing files. The `close-hook` will be used for empty, or missing files.

### Note

If your command writes to stdout, it is vital that you use `>>` in the “append-hook”. If not, data will be lost.

##### 11.3.3.1. Example of `append-hook`

    append-hook '\.gz$' "gzip --stdout '%t' >> '%f'"

- NeoMutt wants to append an email to a folder, “example.gz”, that it opened with `open-hook`

- NeoMutt has an `append-hook` whose regex matches the filename: `\.gz$`

- NeoMutt knows the mailbox type from the `$mbox` variable

- NeoMutt uses the command `gzip -c` to append to an existing compressed file

### Note

The `append-hook` can also include extra options, e.g. compression level: `--best`

#### 11.3.4. Empty Files

NeoMutt assumes that an empty file is not compressed. In this situation, unset $save_empty, so that the compressed file will be removed if you delete all of the messages.

#### 11.3.5. Security

Encrypted files are decrypted into temporary files which are stored in the $tmpdir directory. This could be a security risk.

### 11.4. neomuttrc

    # Example NeoMutt config file for the compress feature.

    # This feature adds three hooks to NeoMutt which allow it to
    # work with compressed, or encrypted, mailboxes.

    # The hooks are of the form:
    #       open-hook   regex "shell-command"
    #       close-hook  regex "shell-command"
    #       append-hook regex "shell-command"
    # The 'append-hook' is optional.

    # Handler for gzip compressed mailboxes
    open-hook   '\.gz$' "gzip --stdout --decompress '%f' >  '%t'"
    close-hook  '\.gz$' "gzip --stdout              '%t' >  '%f'"
    append-hook '\.gz$' "gzip --stdout              '%t' >> '%f'"
    # Handler for bzip2 compressed mailboxes
    open-hook   '\.bz2$' "bzip2 --stdout --decompress '%f' >  '%t'"
    close-hook  '\.bz2$' "bzip2 --stdout              '%t' >  '%f'"
    append-hook '\.bz2$' "bzip2 --stdout              '%t' >> '%f'"
    # Handler for xz compressed mailboxes
    open-hook   '\.xz$' "xz --stdout --decompress '%f' >  '%t'"
    close-hook  '\.xz$' "xz --stdout              '%t' >  '%f'"
    append-hook '\.xz$' "xz --stdout              '%t' >> '%f'"
    # Handler for pgp encrypted mailboxes
    # PGP does not support appending to an encrypted file
    open-hook   '\.pgp$' "pgp -f < '%f' > '%t'"
    close-hook  '\.pgp$' "pgp -fe YourPgpUserIdOrKeyId < '%t' > '%f'"
    # Handler for gpg encrypted mailboxes
    # gpg does not support appending to an encrypted file
    open-hook   '\.gpg$' "gpg --decrypt < '%f' > '%t'"
    close-hook  '\.gpg$' "gpg --encrypt --recipient YourGpgUserIdOrKeyId < '%t' > '%f'"

    # vim: syntax=neomuttrc

### 11.5. See Also

- Regular Expressions

- $tmpdir

- $mbox_type

- $save_empty

- folder-hook

### 11.6. Credits

- Roland Rosenfeld `<roland@spinnaker.de>`

- Alain Penders `<Alain@Finale-Dev.com>`

- Christoph “Myon” Berg `<myon@debian.org>`

- Evgeni Golov `<evgeni@debian.org>`

- Richard Russon `<rich@flatcap.org>`

## 12. Conditional Dates Feature

### Use rules to choose date format

### 12.1. Support

Since: NeoMutt 2016-03-07

Dependencies:

  nested-if feature

### 12.2. Introduction

The “Conditional Dates” feature allows you to construct $index_format expressions based on the age of the email.

NeoMutt's default `$index_format` displays email dates in the form: abbreviated-month day-of-month – “Jan 14”.

The format is configurable but only per-mailbox. This feature allows you to configure the display depending on the age of the email.

Table 6.3. Potential Formatting Scheme

Email Sent | Format | Example
--- | --- | ---
Today | `%H:%M` | 13:23
This Month | `%a %d` | Thu 17
This Year | `%b %d` | Dec 10
Older than 1 Year | `%m/%y` | 06/14

For an explanation of the date formatting strings, see `strftime(3).`

By carefully picking your formats, the dates can remain unambiguous and compact.

NeoMutt's conditional format strings have the form: (whitespace introduced for clarity)

    %? TEST ? TRUE & FALSE ?

The examples below use the test “%[” – the date of the message in the local timezone. They will also work with “%(” – the local time that the message arrived.

The date tests are of the form:

    %[nX? TRUE & FALSE ?

- “n” is an optional count (defaults to 1 if missing)

- “X” is the time period

Table 6.4. Date Formatting Codes

Letter | Time Period
--- | ---
y | Years
m | Months
w | Weeks
d | Days
H | Hours
M | Minutes

Table 6.5. Example Date Tests

Test | Meaning
--- | ---
`%[y` | This year
`%[1y` | This year
`%[6m` | In the last 6 months
`%[w` | This week
`%[d` | Today
`%[4H` | In the last 4 hours

#### 12.2.1. Example 1

We start with a one-condition test.

Table 6.6. Example 1

Test | Date Range | Format String | Example
--- | --- | --- | ---
`%[1m` | This month | `%[%b %d]` | Dec 10
| Older | `%[%Y-%m-%d]` | 2015-04-23

The $index_format string would contain:

    %?[1m?%[%b %d]&%[%Y-%m-%d]?

Reparsed a little, for clarity, you can see the test condition and the two format strings.

    %?[1m?        &           ?

          %[%b %d] %[%Y-%m-%d]

#### 12.2.2. Example 2

This example contains three test conditions and four date formats.

Table 6.7. Example 2

Test | Date Range | Format String | Example
--- | --- | --- | ---
`%[d` | Today | `%[%H:%M ]` | 12:34
`%[m` | This month | `%[%a %d]` | Thu 12
`%[y` | This year | `%[%b %d]` | Dec 10
| Older | `%[%m/%y ]` | 06/15

The $index_format string would contain:

    %<[y?%<[m?%<[d?%[%H:%M ]&%[%a %d]>&%[%b %d]>&%[%m/%y ]>

Reparsed a little, for clarity, you can see the test conditions and the four format strings.

    %<[y?                                       &%[%m/%y ]>  Older
         %<[m?                        &%[%b %d]>             This year
              %<[d?         &%[%a %d]>                       This month
                   %[%H:%M ]                                 Today

This a another view of the same example, with some whitespace for clarity.

    %<[y? %<[m? %<[d? AAA & BBB > & CCC > & DDD >

AAA = %[%H:%M ] BBB = %[%a %d] CCC = %[%b %d] DDD =
%[%m/%y ]

### 12.3. Variables

The “Conditional Dates” feature doesn't have any config of its own. It modifies the behavior of the format strings.

### 12.4. neomuttrc

    # Example NeoMutt config file for the cond-date feature.

    #
    # The default index_format is:
    #       '%4C %Z %{%b %d} %-15.15L (%?l?%4l&%4c?) %s'
    #
    # We replace the date field '%{%b %d}', giving:
    set index_format='%4C %Z %<[y?%<[m?%<[d?%[%H:%M ]&%[%a %d]>&%[%b %d]>&%[%m/%y ]> %-15.15L (%?l?%4l&%4c?) %s'
    # Test  Date Range  Format String  Example
    # --------------------------------------------
    # %[d   Today       %[%H:%M ]      12:34
    # %[m   This month  %[%a %d]       Thu 12
    # %[y   This year   %[%b %d]       Dec 10
    #  —    Older       %[%m/%y ]      06/15

    # vim: syntax=neomuttrc

### 12.5. See Also

- $index_format

- nested-if feature

- `strftime(3)`

### 12.6. Known Bugs

Date parsing doesn't quite do what you expect. “1w” doesn't mean the “in the last 7 days”, but “this week”. This doesn't match the normal NeoMutt behavior: for example `~d>1w` means emails dated in the last 7 days.

### 12.7. Credits

- Aaron Schrab `<aaron@schrab.com>`

- Eric Davis `<edavis@insanum.com>`

- Richard Russon `<rich@flatcap.org>`

## 13. Encrypt-to-Self Feature

### Save a self-encrypted copy of emails

### 13.1. Support

Since: NeoMutt 2016-07-23

Dependencies: None

### 13.2. Introduction

Once you encrypt an email to someone you cannot read it. This is good for security, but bad for record-keeping. If you wanted to keep a copy of an encrypted email you could set $fcc_clear.

A better option is to enable $smime_self_encrypt, then set $smime_default_key to your personal S/MIME key id.

    set smime_self_encrypt = yes
    set smime_default_key  = bb345e23.0

Or, if you use PGP, $pgp_self_encrypt, then set $pgp_default_key to your personal PGP key id.

    set pgp_self_encrypt = yes
    set pgp_default_key  = A4AF18C5582473BD35A1E9CE78BB3D480042198E

If you have different key for signing, then you can set $pgp_sign_as or $smime_sign_as respectively.

### 13.3. Variables

Table 6.8. encrypt-self Variables

Name | Type | Default
--- | --- | ---
`pgp_default_key` | string | (empty)
`pgp_self_encrypt` | boolean | `yes`
`pgp_sign_as` | string | (empty)
`smime_default_key` | string | (empty)
`smime_self_encrypt` | boolean | `yes`
`smime_sign_as` | string | (empty)

### 13.4. neomuttrc

    # Example NeoMutt config file for the encrypt-to-self feature.

    # --------------------------------------------------------------------------
    # VARIABLES – shown with their default values
    # --------------------------------------------------------------------------
    # Save a copy of outgoing email, encrypted to yourself
    set pgp_self_encrypt = "yes"
    set pgp_default_key = "PGP-KEY"
    # set pgp_sign_as = "PGP-SIGNING-KEY"

    # Save a copy of outgoing email, encrypted to yourself
    set smime_self_encrypt = "yes"
    set smime_default_key = "SMIME-KEY"
    # set smime_sign_as = "SMIME-SIGNING-KEY"

    # vim: syntax=neomuttrc

### 13.5. Known Bugs

None

### 13.6. Credits

- Omen Wild `<omen@mandarb.com>`

- Richard Russon `<rich@flatcap.org>`

- Guillaume Brogi `<gui-gui@netcourrier.com>`

## 14. Fmemopen Feature

### Replace some temporary files with memory buffers

### 14.1. Support

Since: NeoMutt 2016-03-07

Dependencies:

  `open_memstream()`, `fmemopen()` from glibc

This feature can be enabled by running `configure` with the option `--enable-fmemopen`

### 14.2. Introduction

The “fmemopen” feature speeds up some searches.

This feature changes a few places where NeoMutt creates temporary files. It replaces them with in-memory buffers. This should improve the performance when searching the header or body using the $thorough_search option.

There are no user-configurable parts.

This feature depends on `open_memstream()` and `fmemopen()`. They are provided by glibc. Without them, NeoMutt will simply create temporary files.

### 14.3. See Also

- Compile-Time Features

- `fmemopen(3)`

### 14.4. Known Bugs

debian bug 834408

### 14.5. Credits

- Julius Plenz `<plenz@cis.fu-berlin.de>`

- Richard Russon `<rich@flatcap.org>`

## 15. Forgotten Attachment Feature

### Alert user when (s)he forgets to attach a file to an outgoing email.

### 15.1. Support

Since: NeoMutt 2016-09-10

Dependencies: None

### 15.2. Introduction

The “forgotten-attachment” feature provides a new setting for NeoMutt that alerts the user if the message body contains a certain keyword but there are no attachments added. This is meant to ensure that the user does not forget to attach a file after promising to do so in the mail. The attachment keyword will not be scanned in text matched by $quote_regex.

### 15.3. Variables

Table 6.9. forgotten-attachment Variables

Name | Type | Default
--- | --- | ---
`abort_noattach_regex` | regular expression | `\\<(attach|attached|attachments?)\\>`
`abort_noattach` | quadoption | `no`

### 15.4. neomuttrc

    # Example NeoMutt config file for the forgotten-attachment feature.

    # The 'forgotten-attachment' feature provides a new setting for NeoMutt that
    # alerts the user if the message body contains a certain regular expression but there are
    # no attachments added. This is meant to ensure that the user does not forget
    # to attach a file after promising to do so in the mail.

    # Ask if the user wishes to abort sending if $abort_noattach_regex is found in the
    # body, but no attachments have been added
    # It can be set to:
    #    "yes"     : always abort
    #    "ask-yes" : ask whether to abort
    #    "no"      : send the mail
    set abort_noattach = no
    # Search for the following regular expression in the body of the email
    # English: attach, attached, attachment, attachments
    set abort_noattach_regex = "\\<attach(|ed|ments?)\\>"
    # Nederlands:
    # set abort_noattach_regex = "\\<(bijvoegen|bijgevoegd|bijlage|bijlagen)\\>"
    # Deutsch:
    # set abort_noattach_regex = "\\<(anhängen|angehängt|anhang|anhänge|hängt an)\\>"
    # Français:
    # set abort_noattach_regex = "\\<(attaché|attachés|attache|attachons|joint|jointe|joints|jointes|joins|joignons)\\>"

    # vim: syntax=neomuttrc

### 15.5. See Also

- The Attachment Menu

- The Attachment Menu key mappings

### 15.6. Known Bugs

None

### 15.7. Credits

- Darshit Shah `<darnir@gmail.com>`

- Richard Russon `<rich@flatcap.org>`

- Johannes Weißl `<jargon@molb.org>`

- Steven! Ragnarök `<steven@nuclearsandwich.com>`

## 16. Global Hooks

### Define actions to run globally within NeoMutt

### 16.1. Introduction

These hooks are called when global events take place in NeoMutt.

Run a command...

- timeout-hook – periodically

- startup-hook – when NeoMutt starts up, before opening the first mailbox

- shutdown-hook – NeoMutt shuts down, before closing the last mailbox

#### 16.1.1. Timeout Hook

##### Run a command periodically

Since: NeoMutt 2016-08-08

This feature implements a new hook that is called periodically when NeoMutt checks for new mail. This hook is called every `$timeout` seconds.

#### 16.1.2. Startup Hook

##### Run a command when NeoMutt starts up, before opening the first mailbox

Since: NeoMutt 2016-11-25

This feature implements a new hook that is called when NeoMutt first starts up, but before opening the first mailbox. This is most likely to be useful to users of notmuch.

#### 16.1.3. Shutdown Hook

##### Run a command when NeoMutt shuts down, before closing the last mailbox

Since: NeoMutt 2016-11-25

This feature implements a hook that is called when NeoMutt shuts down, but before closing the first mailbox. This is most likely to be useful to users of notmuch.

### 16.2. Commands

`timeout-hook` `command`

`startup-hook` `command`

`shutdown-hook` `command`

### 16.3. neomuttrc

    # Example NeoMutt config file for the global hooks feature.

    # --------------------------------------------------------------------------
    # COMMANDS – shown with an example argument
    # --------------------------------------------------------------------------
    # After $timeout seconds of inactivity, run this NeoMutt command
    timeout-hook 'exec sync-mailbox'
    # When NeoMutt first loads, run this NeoMutt command
    startup-hook 'exec sync-mailbox'
    # When NeoMutt quits, run this NeoMutt command
    shutdown-hook 'exec sync-mailbox'

    # vim: syntax=neomuttrc

### 16.4. See Also

- $timeout

### 16.5. Known Bugs

None

### 16.6. Credits

- Armin Wolfermann `<armin@wolfermann.org>`

- Richard Russon `<rich@flatcap.org>`

- Thomas Adam `<thomas@xteddy.org>`

## 17. Ifdef Feature

### Conditional config options

### 17.1. Support

Since: NeoMutt 2016-03-07

Dependencies: None

### 17.2. Introduction

The “ifdef” feature introduces three new commands to NeoMutt and allow you to share one config file between versions of NeoMutt that may have different features compiled in.

    ifdef  symbol "config-command [args...]"  # If a symbol is defined
    ifndef symbol "config-command [args...]"  # If a symbol is not defined
    finish                                    # Finish reading the current file

Here a symbol can be a $variable, <function>, command or compile-time symbol, such as “imap”.

A list of compile-time symbols can be seen in the output of the command

    neomutt -v

(in the “Compile options” section).

`finish` is particularly useful when combined with `ifndef`. e.g.

    # Sidebar config file
    ifndef sidebar finish

### 17.3. Commands

`ifdef` `symbol` `"config-command [args...]"`
`ifndef` `symbol` `"config-command [args...]"`
`finish`

### 17.4. neomuttrc

    # Example NeoMutt config file for the ifdef feature.

    # This feature introduces three useful commands which allow you to share
    # one config file between versions of NeoMutt that may have different
    # features compiled in.

    #   ifdef  symbol "config-command [args...]"
    #   ifndef symbol "config-command [args...]"
    #   finish
    # The 'ifdef' command tests whether NeoMutt understands the name of
    # a variable, function, command or compile-time symbol.

    # If it does, then it executes a config command.

    # The 'ifndef' command tests whether a symbol does NOT exist.

    # The 'finish' command tells NeoMutt to stop reading current config file.

    # If the 'trash' variable exists, set it.
    ifdef trash 'set trash=~/Mail/trash'
    # If the 'tag-pattern' function exists, bind a key to it.
    ifdef tag-pattern 'bind index <F6> tag-pattern'
    # If the 'imap-fetch-mail' command exists, read my IMAP config.
    ifdef imap-fetch-mail 'source ~/.neomutt/imap.rc'
    # If the compile-time symbol 'sidebar' does not exist, then
    # stop reading the current config file.
    ifndef sidebar finish

    # vim: syntax=neomuttrc

### 17.5. Known Bugs

None

### 17.6. Credits

- Cedric Duval `<cedricduval@free.fr>`

- Matteo F. Vescovi `<mfvescovi@gmail.com>`

- Richard Russon `<rich@flatcap.org>`

## 18. Index Color Feature

### Custom rules for theming the email index

### 18.1. Support

Since: NeoMutt 2016-03-07

Dependencies:

  status-color feature

### 18.2. Introduction

The “index-color” feature allows you to specify colors for individual parts of the email index. e.g. Subject, Author, Flags.

First choose which part of the index you'd like to color. Then, if needed, pick a pattern to match.

Note: The pattern does not have to refer to the object you wish to color. e.g.

    color index_author red default "~sneomutt"

The author appears red when the subject (~s) contains “neomutt”.

### 18.3. Colors

All the colors default to `default`, i.e. unset.

The index objects can be themed using the `color` command. Some objects require a pattern.

    color index-object foreground background
    color index-object foreground background pattern

Table 6.10. Index Colors

Object | Pattern | Highlights
--- | --- | ---
`index` | yes | Entire index line
`index_author` | yes | Author name, %A %a %F %L %n
`index_collapsed` | no | Number of messages in a collapsed thread, %M
`index_date` | no | Date field
`index_flags` | yes | Message flags, %S %Z
`index_label` | no | Message label, %y %Y
`index_number` | no | Message number, %C
`index_size` | no | Message size, %c %l
`index_subject` | yes | Subject, %s

### 18.4. neomuttrc

    # Example NeoMutt config file for the index-color feature.

    # Entire index line
    color index white black '.*'
    # Author name, %A %a %F %L %n
    # Give the author column a dark grey background
    color index_author default color234 '.*'
    # Highlight a particular from (~f)
    color index_author brightyellow color234 '~fRay Charles'
    # Message flags, %S %Z
    # Highlight the flags for flagged (~F) emails
    color index_flags default red '~F'
    # Subject, %s
    # Look for a particular subject (~s)
    color index_subject brightcyan default '~s\(closes #[0-9]+\)'
    # Number of messages in a collapsed thread, %M
    color index_collapsed default brightblue
    # Date field
    color index_date green default
    # Message label, %y %Y
    color index_label default brightgreen
    # Message number, %C
    color index_number red default
    # Message size, %c %l
    color index_size cyan default

    # vim: syntax=neomuttrc

### 18.5. See Also

- Regular Expressions

- Patterns

- $index_format

- Color command

- Status-Color feature

### 18.6. Known Bugs

None

### 18.7. Credits

- Christian Aichinger `<Greek0@gmx.net>`

- Christoph “Myon” Berg `<myon@debian.org>`

- Elimar Riesebieter `<riesebie@lxtec.de>`

- Eric Davis `<edavis@insanum.com>`

- Vladimir Marek `<Vladimir.Marek@oracle.com>`

- Richard Russon `<rich@flatcap.org>`

## 19. Initials Expando Feature

### Expando for author's initials

### 19.1. Support

Since: NeoMutt 2016-03-07

Dependencies: None

### 19.2. Introduction

The “initials” feature adds an expando (%I) for an author's initials.

The index panel displays a list of emails. Its layout is controlled by the $index_format variable. Using this expando saves space in the index panel. This can be useful if you are regularly working with a small set of people.

### 19.3. Variables

This feature has no config of its own. It adds an expando which can be used in the $index_format variable.

### 19.4. neomuttrc

    # Example NeoMutt config file for the initials feature.

    # The 'initials' feature has no config of its own.

    # It adds an expando for an author's initials,
    # which can be used in the 'index_format' variable.

    # The default 'index_format' is:
    set index_format='%4C %Z %{%b %d} %-15.15L (%?l?%4l&%4c?) %s'
    # Where %L represents the author/recipient
    # This might look like:
    #       1   + Nov 17 David Bowie   Changesbowie    ( 689)
    #       2   ! Nov 17 Stevie Nicks  Rumours         ( 555)
    #       3   + Nov 16 Jimi Hendrix  Voodoo Child    ( 263)
    #       4   + Nov 16 Debbie Harry  Parallel Lines  ( 540)
    # Using the %I expando:
    set index_format='%4C %Z %{%b %d} %I (%?l?%4l&%4c?) %s'
    # This might look like:
    #       1   + Nov 17 DB Changesbowie    ( 689)
    #       2   ! Nov 17 SN Rumours         ( 555)
    #       3   + Nov 16 JH Voodoo Child    ( 263)
    #       4   + Nov 16 DH Parallel Lines  ( 540)

    # vim: syntax=neomuttrc

### 19.5. See Also

- $index_format

- index-color feature

- folder-hook

### 19.6. Known Bugs

None

### 19.7. Credits

- Vsevolod Volkov `<vvv@mutt.org.ua>`

- Richard Russon `<rich@flatcap.org>`

## 20. Kyoto Cabinet Feature

### Kyoto Cabinet backend for the header cache

### 20.1. Support

Since: NeoMutt 2016-10-02

Dependencies:

  Kyoto Cabinet libraries

To check if NeoMutt supports Kyoto Cabinet, look for

- “kyoto” in the NeoMutt version.

- “+hcache” in the compile options

- “hcache backend: kyotocabinet” in the NeoMutt version

### 20.2. Introduction

This feature adds support for using Kyoto Cabinet, the successor to Tokyo Cabinet, as a storage backend for NeoMutt's header cache (hcache). It is enabled at configure time with the --with-kyotocabinet=<path> switch.

### 20.3. See Also

- Local Caching

- Kyoto Cabinet

### 20.4. Known Bugs

None

### 20.5. Credits

- Clemens Lang `<neverpanic@gmail.com>`

## 21. Limit Current Thread Feature

### Focus on one Email Thread

### 21.1. Support

Since: NeoMutt 2016-03-28

Dependencies: None

### 21.2. Introduction

This feature adds a new way of using the Limit Command. The `<limit-current-thread>` function restricts the view to just the current thread. Setting the limit (the `l` key) to “all” will restore the full email list.

### 21.3. Functions

Limit-current-thread adds the following function to NeoMutt. By default, it is not bound to a key.

Table 6.11. Limit-Current-Thread Functions

Menus | Function | Description
--- | --- | ---
index | `<limit-current-thread>` | Limit view to current thread

### 21.4. neomuttrc

    # Example NeoMutt config file for the limit-current-thread feature.

    # Limit view to current thread
    bind index <esc>L limit-current-thread

    # vim: syntax=neomuttrc

### 21.5. Known Bugs

None

### 21.6. Credits

- David Sterba `<dsterba@suse.cz>`

- Richard Russon `<rich@flatcap.org>`

## 22. LMDB Feature

### LMDB backend for the header cache

### 22.1. Support

Since: NeoMutt 2016-07-23

Dependencies: None

### 22.2. Introduction

This feature adds support for using LMDB as a storage backend for NeoMutt's header cache (hcache). It is enabled at configure time with the --with-lmdb=<path> switch.

### Note

It is not recommended to store the lmdb database on a shared drive.

### 22.3. See Also

- Local Caching

### 22.4. Known Bugs

None

### 22.5. Credits

- Pietro Cerutti `<gahr@gahr.ch>`

- Jan-Piet Mens `<jp@mens.de>`

- Clemens Lang `<neverpanic@gmail.com>`

## 23. Multiple FCC Feature

### Save multiple copies of outgoing mail

### 23.1. Support

Since: NeoMutt 2016-08-08

Dependencies: None

### 23.2. Introduction

This feature allows the user to save outgoing emails in multiple folders.

Folders should be listed separated by commas, but no spaces.

The “fcc” field of an email can be set in two ways:

- The <edit-fcc> command in the compose menu (default key: “f”)

- Creating a `fcc-hook` in your `.neomuttrc`

### 23.3. See Also

- $record

- fcc-hook

### 23.4. Known Bugs

None

### 23.5. Credits

- Omen Wild `<omen@mandarb.com>`

- Richard Russon `<rich@flatcap.org>`

## 24. Nested If Feature

### Allow complex nested conditions in format strings

### 24.1. Support

Since: NeoMutt 2016-03-07

Dependencies: None

### 24.2. Introduction

NeoMutt's format strings can contain embedded if-then-else conditions. They are of the form:

    %?VAR?TRUE&FALSE?

If the variable “VAR” has a value greater than zero, print the “TRUE” string, otherwise print the “FALSE” string.

e.g. `%?S?Size: %S&Empty?`

Which can be read as:

if (%S > 0) { print "Size: %S" } else { print "Empty" }

These conditions are useful, but in NeoMutt they cannot be nested within one another. This feature uses the notation `%<VAR?TRUE&FALSE>` and allows them to be nested.

The `%<...>` notation was used to format the current local time. but that's not really very useful since NeoMutt has no means of refreshing the screen periodically.

A simple nested condition might be: (Some whitespace has been introduced for clarity)

    %<x? %<y? XY & X > & %<y? Y & NONE > >  Conditions
         %<y? XY & X >                      x>0
              XY                            x>0,y>0
                   X                        x>0,y=0

    %<x? %<y? XY & X > & %<y? Y & NONE > >  Conditions
                         %<y? Y & NONE >    x=0
                              Y             x=0,y>0
                                  NONE      x=0,y=0

Equivalent to:

if (x > 0) {
if (y > 0) {
print 'XY'
} else {
print 'X'
}
} else {
if (y > 0) {
print 'Y'
} else {
print 'NONE'
}
}

Examples:

    set index_format='%4C %Z %{%b %d} %-25.25n %s%> %<M?%M Msgs &%<l?%l Lines&%c Bytes>>'

if a thread is folded display the number of messages (%M)
else if we know how many lines in the message display lines in message (%l)
else display the size of the message in bytes (%c)

    set index_format='%4C %Z %{%b %d} %-25.25n %<M?[%M] %s&%s%* %<l?%l&%c>>'

if a thread is folded display the number of messages (%M) and the subject (%s)
else if we know how many lines are in the message display subject (%s) and the lines in message (%l)
else display the subject (%s) and the size of the message in bytes (%c)

### Note

If you wish to use angle brackets `< >` in a nested condition, then it's necessary to escape them, e.g.

    set index_format='%<M?\<%M\>&%s>'

### 24.3. Variables

The “nested-if” feature doesn't have any config of its own. It modifies the behavior of the format strings.

### 24.4. neomuttrc

    # Example NeoMutt config file for the nested-if feature.

    # This feature uses the format: '%<VAR?TRUE&FALSE>' for conditional
    # format strings that can be nested.

    # Example 1
    # if a thread is folded
    #       display the number of messages (%M)
    # else if we know how many lines in the message
    #       display lines in message (%l)
    # else display the size of the message in bytes (%c)
    set index_format='%4C %Z %{%b %d} %-25.25n %s%> %<M?%M Msgs &%<l?%l Lines&%c Bytes>>'

    # Example 2
    # if a thread is folded
    #       display the number of messages (%M)
    #       display the subject (%s)
    # else if we know how many lines in the message
    #       display lines in message (%l)
    # else
    #       display the size of the message in bytes (%c)
    set index_format='%4C %Z %{%b %d} %-25.25n %<M?[%M] %s&%s%* %<l?%l&%c>>'

    # vim: syntax=neomuttrc

### 24.5. See Also

- cond-date feature

- $index_format

- $status_format

### 24.6. Known Bugs

This feature is hard to understand

### 24.7. Credits

- David Champion `<dgc@uchicago.edu>`

- Richard Russon `<rich@flatcap.org>`

- Aleksa Sarai `<cyphar@cyphar.com>`

## 25. New Mail Feature

### Execute a command upon the receipt of new mail.

### 25.1. Support

Since: NeoMutt 2016-07-23

Dependencies: None

### 25.2. Introduction

This feature enables the new_mail_command setting, which can be used to execute a custom script (e.g. a notification handler) upon receiving a new mail.

The command string can contain expandos, such as `%n` for the number of new messages. For a complete list, see: $status_format.

### Note

When the notification is sent, the folder of the new mail is no longer known. This is a limitation of NeoMutt. The `%f` expando will show the open folder.

For example in Linux you can use (most distributions already provide notify-send):

    set new_mail_command="notify-send --icon='/home/santiago/Pictures/neomutt.png' \
      'New Email' '%n new messages, %u unread.' &"

And in OS X you will need to install a command line interface for Notification Center, for example terminal-notifier:

    set new_mail_command="terminal-notifier -title '%v' -subtitle 'New Mail' \
      -message '%n new messages, %u unread.' -activate 'com.apple.Terminal'"

### 25.3. Variables

Table 6.12. New Mail Command Variables

Name | Type | Default
--- | --- | ---
`new_mail_command` | string | (empty)

### 25.4. neomuttrc

    # Example NeoMutt config file for the new-mail feature.

    # --------------------------------------------------------------------------
    # VARIABLES – shown with their default values
    # --------------------------------------------------------------------------
    # Set the command you want NeoMutt to execute upon the receipt of a new email
    set new_mail_command = ""
    # Linux example:
    # set new_command="notify-send --icon='/home/santiago/Pictures/neomutt.png' \
    #   'New Email in %f' '%n new messages, %u unread.' &"
    # OS X example:
    # set new_mail_command="terminal-notifier -title '%v' -subtitle 'New Mail in %f' \
    #   -message '%n new messages, %u unread.' -activate 'com.apple.Terminal'"
    # --------------------------------------------------------------------------

    # vim: syntax=neomuttrc

### 25.5. See Also

- folder-hook

### 25.6. Known Bugs

None

### 25.7. Credits

- Yoshiki Vazquez-Baeza `<yoshiki@ucsd.edu>`

- Santiago Torres-Arias `<santiago@nyu.edu>`

- Richard Russon `<rich@flatcap.org>`

## 26. NNTP Feature

### Talk to a Usenet news server

### 26.1. Support

Since: NeoMutt 2016-05-30

Dependencies: None

### 26.2. Introduction

Reading news via NNTP

NeoMutt can read from a news server using NNTP.

The default news server can be obtained from the `$NNTPSERVER` environment variable or from the `/etc/nntpserver` file. Like in other news readers, information about the subscribed newsgroups is saved in the file specified by the $newsrc variable. You can open a newsgroup with the function `<change-newsgroup>`

The variable $news_cache_dir can be used to point to a directory. NeoMutt will create a hierarchy of subdirectories named like the account and newsgroup the cache is for. The hierarchy is also used to store header cache if NeoMutt was compiled with header cache support.

### 26.3. Variables

Table 6.13. NNTP Variables

Name | Type | Default
--- | --- | ---
`ask_follow_up` | boolean | `no`
`ask_x_comment_to` | boolean | `no`
`catchup_newsgroup` | quad | `ask-yes`
`followup_to_poster` | quad | `ask-yes`
`group_index_format` | string | `%4C %M%N %5s %-45.45f %d`
`inews` | string | (empty)
`mime_subject` | boolean | `yes`
`newsgroups_charset` | string | `utf-8`
`newsrc` | string | `~/.newsrc`
`news_cache_dir` | string | `~/.neomutt`
`news_server` | string | (empty)
`nntp_authenticators` | string | (empty)
`nntp_context` | number | `1000`
`nntp_listgroup` | boolean | `yes`
`nntp_load_description` | boolean | `yes`
`nntp_pass` | string | (empty)
`nntp_poll` | number | `60`
`nntp_user` | string | (empty)
`post_moderated` | quad | `ask-yes`
`save_unsubscribed` | boolean | `no`
`show_new_news` | boolean | `yes`
`show_only_unread` | boolean | `no`
`x_comment_to` | boolean | `no`

### 26.4. Functions

NNTP adds the following functions to NeoMutt. By default, none of them are bound to keys.

Table 6.14. NNTP Functions

Menus | Function | Description
--- | --- | ---
browser,index | `<catchup>` | mark all articles in newsgroup as read
index,pager | `<change-newsgroup>` | open a different newsgroup
compose | `<edit-followup-to>` | edit the Followup-To field
compose | `<edit-newsgroups>` | edit the newsgroups list
compose | `<edit-x-comment-to>` | edit the X-Comment-To field
attach,index,pager | `<followup-message>` | followup to newsgroup
index,pager | `<post-message>` | post message to newsgroup
browser | `<reload-active>` | load list of all newsgroups from NNTP server
browser | `<subscribe>` | subscribe to current mbox (IMAP/NNTP only)
browser | `<subscribe-pattern>` | subscribe to newsgroups matching a pattern
browser | `<uncatchup>` | mark all articles in newsgroup as unread
browser | `<unsubscribe>` | unsubscribe from current mbox (IMAP/NNTP only)
browser | `<unsubscribe-pattern>` | unsubscribe from newsgroups matching a pattern
index,pager | `<change-newsgroup-readonly>` | open a different newsgroup in read only mode
attach,index,pager | `<forward-to-group>` | forward to newsgroup
index | `<get-children>` | get all children of the current message
index | `<get-parent>` | get parent of the current message
index | `<reconstruct-thread>` | reconstruct thread containing current message
index | `<get-message>` | get message with Message-Id

### 26.5. neomuttrc

    # Example NeoMutt config file for the nntp feature.

    # --------------------------------------------------------------------------
    # VARIABLES – shown with their default values
    # --------------------------------------------------------------------------
    set ask_follow_up = no
    set ask_x_comment_to = no
    set catchup_newsgroup = ask-yes
    set followup_to_poster = ask-yes
    set group_index_format = '%4C %M%N %5s  %-45.45f %d'
    set inews = ''
    set mime_subject = yes
    set newsgroups_charset = utf-8
    set newsrc = '~/.newsrc'
    set news_cache_dir = '~/.neomutt'
    set news_server = ''
    set nntp_authenticators = ''
    set nntp_context = 1000
    set nntp_listgroup = yes
    set nntp_load_description = yes
    set nntp_pass = ''
    set nntp_poll = 60
    set nntp_user = ''
    set post_moderated = ask-yes
    set save_unsubscribed = no
    set show_new_news = yes
    set show_only_unread = no
    set x_comment_to = no
    # --------------------------------------------------------------------------
    # FUNCTIONS – shown with an example mapping
    # --------------------------------------------------------------------------
    # mark all articles in newsgroup as read
    bind browser,index y catchup
    # open a different newsgroup
    bind index,pager i change-newsgroup
    # edit the Followup-To field
    bind compose o edit-followup-to
    # edit the newsgroups list
    bind compose N edit-newsgroups
    # edit the X-Comment-To field
    bind compose x edit-x-comment-to
    # followup to newsgroup
    bind attach,index,pager F followup-message
    # post message to newsgroup
    bind index,pager P post-message
    # load list of all newsgroups from NNTP server
    bind browser g reload-active
    # subscribe to current mbox (IMAP/NNTP only)
    bind browser s subscribe
    # subscribe to newsgroups matching a pattern
    bind browser S subscribe-pattern
    # mark all articles in newsgroup as unread
    bind browser Y uncatchup
    # unsubscribe from current mbox (IMAP/NNTP only)
    bind browser u unsubscribe
    # unsubscribe from newsgroups matching a pattern
    bind browser U unsubscribe-pattern
    # open a different newsgroup in read only mode
    bind index,pager \ei change-newsgroup-readonly
    # forward to newsgroup
    bind attach,index,pager \eF forward-to-group
    # get all children of the current message
    # bind index ??? get-children
    # get parent of the current message
    bind index \eG get-parent
    # reconstruct thread containing current message
    # bind index ??? reconstruct-thread
    # get message with Message-Id
    bind index \CG get-message
    # --------------------------------------------------------------------------

    # vim: syntax=neomuttrc

### 26.6. Known Bugs

None

### 26.7. Credits

- Vsevolod Volkov `<vvv@mutt.org.ua>`

- Felix von Leitner `<leitner@fefe.de>`

- Richard Russon `<rich@flatcap.org>`

## 27. Custom backend based Tags Feature

### Implements Notmuch tags and Imap keywords

### 27.1. Support

Since: NeoMutt 2017-10-16

Dependencies:

- quasi-delete feature

- index-color feature

### 27.2. Introduction

Some backends allow to index and tags mail without storing the tags within the mail envelope. Two backends are currently implementing this feature. Notmuch handles them natively and IMAP stores them in custom IMAP keywords.

### 27.3. Variables

Table 6.15. Custom tags Variables

Name | Type | Default
--- | --- | ---
`hidden_tags` | string | `unread,draft,flagged,passed,replied,attachment,signed,encrypted`

### 27.4. Functions

Notmuch adds the following functions to NeoMutt. By default, none of them are bound to keys.

Table 6.16. Notmuch/IMAP Functions

Menus | Function | Description
--- | --- | ---
index,pager | `<modify-labels>` | add, remove, or toggle tags: IMAP: edit the tags list Notmuch: [+]<tag> to add, -<tag> to remove, !<tag> to toggle(notmuch) tags. Note: Tab completion of tag names is available

index,pager

`<modify-labels-then-hide>`

add, remove, or toggle tags IMAP: edit the tags list Notmuch: [+]<tag> to add, -<tag> to remove, !<tag> to toggle labels and then hide or unhide the message by changing the "quasi-deleted" to match if it would be shown when requerying. Normal redisplay rules apply here, so the user must call <sync-mailbox> for the changes to be displayed. Note: Tab completion of tag names is available.

### 27.5. Commands

`tag-transforms` `tag` `transformed-string` { `tag` `transformed-string` ...}
`tag-formats` `tag` `format-string` { `tag` `format-string` ...}

### 27.6. Colors

Adds these to index-color feature:

Table 6.17. Index Colors

Object | Pattern | Highlights
--- | --- | ---
`index_tag` | yes | an individual message tag, %G, uses tag name
`index_tags` | no | the transformed message tags, %g or %J

### 27.7. neomuttrc

    # Example NeoMutt config file for the custom tags feature.

    # VARIABLES – shown with their default values
    # --------------------------------------------------------------------------
    # This variable specifies private notmuch tags which should not be printed
    # on screen (index, pager).
    set nm_hidden_tags = "unread,draft,flagged,passed,replied,attachment,signed,encrypted"
    # --------------------------------------------------------------------------
    # FUNCTIONS – shown with an example mapping
    # --------------------------------------------------------------------------
    # modify (notmuch/imap) tags
    bind index,pager \` modify-labels
    # modify (notmuch/imap) tag non-interactively.
    bind index,pager tt "<modify-labels>!todo\n" "Toggle the 'todo' tag"
    # modify labels and then hide message
    # bind index,pager ??? modify-labels-then-hide
    # --------------------------------------------------------------------------
    # COMMANDS – shown with an example
    # --------------------------------------------------------------------------
    # Replace some tags with icons
    # tag-transforms tag transformed-string { tag transformed-string ...}
    # tag-transforms "inbox"   "i"   \
    #                "unread"  "u"   \
    #                "replied" "↻ "  \
    #                "sent"    "➥ "  \
    #                "todo"    "T"   \
    #                "deleted" "DEL" \
    #                "invites" "CAL"

    # The formats must start with 'G' and the entire sequence is case sensitive.
    # tag-formats tag format-string { tag format-string ...}
    # tag-formats "inbox"   "GI" \
    #             "unread"  "GU" \
    #             "replied" "GR" \
    #             "sent"    "GS" \
    #             "todo"    "Gt" \
    #             "deleted" "GD" \
    #             "invites" "Gi"

    # Now instead of using '%g' or '%J' in your $index_format, which lists all tags
    # in a non-deterministic order, you can something like the following which puts
    # a transformed tag name in a specific spot on the index line:
    # set index_format='%4C %S %[%y.%m.%d] %-18.18n %?GU?%GU& ? %?GR?%GR& ? %?GI?%GI& ? %s'

    # The %G formatting sequence may display all tags including tags hidden by
    # nm_hidden_tags.
    #
    # --------------------------------------------------------------------------
    # COLORS – some unpleasant examples are given
    # --------------------------------------------------------------------------
    # These symbols are added to the index-color feature:
    # an individual message tag, %G, uses tag name
    # this symbol uses a pattern
    color index_tag red white "inbox"
    # the transformed message tags, %g
    # this symbol does not use a pattern
    color index_tags green default
    # --------------------------------------------------------------------------

    # vim: syntax=neomuttrc

### 27.8. Credits

- Mehdi Abaakouk `<sileht@sileht.net>`

- Richard Russon `<rich@flatcap.org>`

- Bernard 'Guyzmo' Pratz `<guyzmo+github+pub@m0g.net>`

## 28. Notmuch Feature

### Email search engine

### 28.1. Support

Since: NeoMutt 2016-03-17

Dependencies:

- quasi-delete feature

- index-color feature

- Notmuch libraries

### 28.2. Introduction

Notmuch is an email fulltext indexing and tagging engine.

- For more information, see: https://notmuchmail.org/

- More examples: https://notmuchmail.org/mutttips/

### 28.3. Using Notmuch

#### 28.3.1. Folders URI

notmuch://[<path>][?<item>=<name>[& ...]]

The <path> is an absolute path to the directory where the notmuch database is found as returned by “notmuch config get database.path” command. Note that the <path> should NOT include `.notmuch` directory name.

If the "<path>" is not defined then `$nm_default_uri` or `$folder` is used, for example:

    set nm_default_uri = "notmuch:///home/foo/maildir"
    virtual-mailboxes "My INBOX" "notmuch://?query=tag:inbox"

#### 28.3.2. Items

query=<string>

See SEARCH SYNTAX in notmuch man page. Don't forget to use operators (“and”/“or”) in your queries.

Note that proper URI should not contain blank space and all “bad” chars should be encoded, for example

`tag:AAA and tag:BBB` – encoding -> `tag:AAA%20and%20tag:BBB`

but NeoMutt config file parser is smart enough to accept space in quoted strings. It means that you can use

`notmuch:///foo?query=tag:AAA and tag:BBB`

in your config files to keep things readable.

For more details about Xapian queries, see: https://xapian.org/docs/queryparser.html

limit=<number>

Restricts number of messages/threads in the result. The default limit is nm_db_limit.

type=<threads|messages>

Reads all matching messages or whole-threads. The default is 'messages' or nm_query_type.

#### 28.3.3. Format String for the Notmuch Browser

Default:

`%2C %?n?%4n/& ?%4m %f`

This variable allows you to customize the browser display to your personal taste. This string is similar to $index_format, but has its own set of `printf(3)`-like sequences:

%C | current file number
%f | folder name (description)
%m | number of messages in the mailbox *
%n | number of unread messages in the mailbox *
%N | N if mailbox has new mail, blank otherwise
%>X | right justify the rest of the string and pad with character “X”
%|X | pad to the end of the line with character “X”
%*X | soft-fill with character “X” as pad

For an explanation of “soft-fill”, see the $index_format documentation.

* = can be optionally printed if nonzero

### 28.4. Variables

Table 6.18. Notmuch Variables

Name | Type | Default
--- | --- | ---
`nm_db_limit` | number | `0`
`nm_default_uri` | string | (empty)
`nm_exclude_tags` | string | (empty)
`nm_open_timeout` | number | `5`
`nm_query_type` | string | `messages`
`nm_record` | boolean | `no`
`nm_record_tags` | string | (empty)
`nm_unread_tag` | string | `unread`
`vfolder_format` | string | `%6n(%6N) %f`
`virtual_spoolfile` | boolean | `no`

More variables about tags configuration can be found in Custom backend Tags Feature

### 28.5. Functions

Notmuch adds the following functions to NeoMutt. By default, none of them are bound to keys.

Table 6.19. Notmuch Functions

Menus | Function | Description
--- | --- | ---
index,pager | `<change-vfolder>` | switch to another virtual folder, a new folder maybe be specified by vfolder description (see virtual-mailboxes) or URI. the default is next vfolder with unread messages
index,pager | `<entire-thread>` | read entire thread of the current message
index,pager | `<sidebar-toggle-virtual>` | toggle between mailboxes and virtual mailboxes
index,pager | `<vfolder-from-query>` | generate virtual folder from notmuch search query. Note: TAB completion of 'tag:' names is available.
index,pager | `<vfolder-window-forward>` | generate virtual folder by moving the query's time window forward
index,pager | `<vfolder-window-backward>` | generate virtual folder by moving the query's time window backward

More functions about tags can be found in Custom backend Tags Feature

### 28.6. Commands

`virtual-mailboxes` `description` `notmuch-URI` { `description` `notmuch-URI` ...}
`unvirtual-mailboxes` { `*` | `mailbox` ... }

More commands about tags can be found in Custom backend Tags Feature

### 28.7. Colors

See Custom backend Tags colors

### 28.8. neomuttrc

    # Example NeoMutt config file for the notmuch feature.

    # --------------------------------------------------------------------------
    # VARIABLES – shown with their default values
    # --------------------------------------------------------------------------
    # This variable specifies notmuch query limit.
    set nm_db_limit = 0
    # This variable specifies the default Notmuch database in format:
    # notmuch://<absolute path>
    set nm_default_uri = ""
    # The messages tagged with these tags are excluded and not loaded
    # from notmuch DB to NeoMutt unless specified explicitly.
    set nm_exclude_tags = ""
    # This option specifies timeout for Notmuch database. Default is 5 seconds.
    set nm_open_timeout = 5
    # This variable specifies notmuch query type, supported types: 'threads' and
    # 'messages'.
    set nm_query_type = messages
    # Add messages stored to the NeoMutt record (see $record in the NeoMutt docs)
    # also to notmuch DB. If you reply to an email then the new email inherits
    # tags from the original email.
    set nm_record = no
    # Tags that should be removed or added to the to the messages stored in the NeoMutt record.
    # example:
    #   set record = "~/sent-mails"
    #   set nm_record = yes
    #   set nm_record_tags = "-inbox,archive,me"
    set nm_record_tags = ""
    # This variable specifies notmuch tag which is used for unread messages.
    set nm_unread_tag = unread
    # This variable allows you to customize the file browser display for virtual
    # folders to your personal taste.
    # %C   current folder number
    # %f   folder name (description)
    # %m   number of messages in the mailbox *
    # %n   number of unread messages in the mailbox *
    # %N   N if mailbox has new mail, blank otherwise
    # %>X  right justify the rest of the string and pad with character ``X''
    # %|X  pad to the end of the line with character ``X''
    # %*X  soft-fill with character ``X'' as pad
    set vfolder_format = "%6n(%6N) %f"
    # When set, NeoMutt will use the first virtual mailbox (see virtual-mailboxes)
    # as a spoolfile.
    set virtual_spoolfile = no
    # setup time window preferences
    # first setup the duration, and then the time unit of that duration
    # when set to 0 (the default) the search window feature is disabled
    set nm_query_window_duration=2
    set nm_query_window_timebase="week" # or "hour", "day", "week", "month", "year"
    # --------------------------------------------------------------------------
    # FUNCTIONS – shown with an example mapping
    # --------------------------------------------------------------------------
    # open a different virtual folder
    bind index,pager X change-vfolder
    # read entire thread of the current message
    bind index,pager + entire-thread
    # generate virtual folder from query
    bind index,pager \eX vfolder-from-query
    # generate virtual folder from query with time window
    bind index,pager < vfolder-window-backward
    bind index,pager > vfolder-window-forward
    # toggle between mailboxes and virtual mailboxes
    # bind index,pager ??? sidebar-toggle-virtual
    # --------------------------------------------------------------------------
    # COMMANDS – shown with an example
    # --------------------------------------------------------------------------
    # virtual-mailboxes description notmuch-URI { description notmuch-URI ...}
    # virtual-mailboxes "Climbing" "notmuch://?query=climbing"
    # unvirtual-mailboxes { * | mailbox ...}
    #
    # --------------------------------------------------------------------------

    # vim: syntax=neomuttrc

### 28.9. See Also

- Compile-Time Features

### 28.10. Known Bugs

None

### 28.11. Credits

- Karel Zak `<kzak@redhat.com>`

- Chris Mason `<clm@fb.com>`

- Christoph Rissner `<cri@visotech.at>`

- David Riebenbauer `<davrieb@liegesta.at>`

- David Sterba `<dsterba@suse.cz>`

- David Wilson `<dw@botanicus.net>`

- Don Zickus `<dzickus@redhat.com>`

- Eric Davis `<edavis@insanum.com>`

- Jan Synacek `<jsynacek@redhat.com>`

- Jeremiah C. Foster `<jeremiah@jeremiahfoster.com>`

- Josh Poimboeuf `<jpoimboe@redhat.com>`

- Kirill A. Shutemov `<kirill@shutemov.name>`

- Luke Macken `<lmacken@redhat.com>`

- Mantas Mikulėnas `<grawity@gmail.com>`

- Patrick Brisbin `<pbrisbin@gmail.com>`

- Philippe Le Brouster `<plb@nebkha.net>`

- Raghavendra D Prabhu `<rprabhu@wnohang.net>`

- Sami Farin `<hvtaifwkbgefbaei@gmail.com>`

- Stefan Assmann `<sassmann@kpanic.de>`

- Stefan Kuhn `<p_regius@gmx.ch>`

- Tim Stoakes `<tim@stoakes.net>`

- Vladimir Marek `<Vladimir.Marek@oracle.com>`

- Víctor Manuel Jáquez Leal `<vjaquez@igalia.com>`

- Richard Russon `<rich@flatcap.org>`

- Bernard 'Guyzmo' Pratz `<guyzmo+github+pub@m0g.net>`

## 29. Progress Bar Feature

### Show a visual progress bar on slow operations

### 29.1. Support

Since: NeoMutt 2016-03-07

Dependencies: None

### 29.2. Introduction

The “progress” feature shows a visual progress bar on slow tasks, such as indexing a large folder over the net.

### 29.3. Colors

Table 6.20. Progress Colors

Name | Default Color | Description
--- | --- | ---
`progress` | default | Visual progress bar

### 29.4. neomuttrc

    # Example NeoMutt config file for the progress feature.

    # The 'progress' feature provides clear visual feedback for
    # slow tasks, such as indexing a large folder over the net.

    # Set the color of the progress bar
    # White text on a red background
    color progress white red

    # vim: syntax=neomuttrc

### 29.5. See Also

- Color command

### 29.6. Known Bugs

None

### 29.7. Credits

- Rocco Rutte `<pdmef@gmx.net>`

- Vincent Lefevre `<vincent@vinc17.org>`

- Stefan Kuhn `<wuodan@hispeed.ch>`

- Karel Zak `<kzak@redhat.com>`

- Richard Russon `<rich@flatcap.org>`

## 30. Quasi-Delete Feature

### Mark emails that should be hidden, but not deleted

### 30.1. Support

Since: NeoMutt 2016-03-07

Dependencies: None

### 30.2. Introduction

The “quasi-delete” function marks an email that should be hidden from the index, but NOT deleted. The email will disappear from the index when <sync-mailbox> is called.

On its own, this feature isn't very useful. It forms a useful part of the notmuch plugin.

### 30.3. Functions

Table 6.21. Quasi-Delete Functions

Menus | Default Key | Function | Description
--- | --- | --- | ---
index,pager | (none) | `<quasi-delete>` | delete from NeoMutt, don't touch on disk

### 30.4. neomuttrc

    # Example NeoMutt config file for the quasi-delete feature.

    # The 'quasi-delete' function marks an email that should be hidden
    # from the index, but NOT deleted.
    bind index,pager Q quasi-delete

    # vim: syntax=neomuttrc

### 30.5. See Also

- notmuch feature

### 30.6. Known Bugs

None

### 30.7. Credits

- Karel Zak `<kzak@redhat.com>`

- Richard Russon `<rich@flatcap.org>`

## 31. Reply With X-Original-To Feature

### Direct reply to email using X-Original-To header

### 31.1. Support

Since: NeoMutt 2016-09-10

Dependencies: None

### 31.2. Introduction

Adds a reply_with_xorig for NeoMutt configuration files. If enabled, allows to reply to an email using the email address in the first X-Original-To: header of a mail as the From: header of the answer.

### 31.3. Variables

Table 6.22. Reply With X-Original-To Variables

Name | Type | Default
--- | --- | ---
`reply_with_xorig` | Boolean | `no`

### 31.4. neomuttrc

    # Example NeoMutt config file for the reply-with-xorig feature.

    # --------------------------------------------------------------------------
    # VARIABLES – shown with their default values
    # --------------------------------------------------------------------------
    # Use X-Original-To header to reply when reverse is disabled or no alternate
    # is found.
    set reply_with_xorig = "yes"

    # vim: syntax=neomuttrc

### 31.5. Credits

- Pierre-Elliott Bécue `<becue@crans.org>`

## 32. Sensible Browser Feature

### Make the file browser behave

### 32.1. Support

Since: NeoMutt 2016-09-10

Dependencies: None

### 32.2. Introduction

The “sensible browser” is a set of small changes to NeoMutt's mailbox browser which make the browser behave in a more predictable way.

The behavior is divided into two use cases: Fixed Order; Variable Order.

#### 32.2.1. A Fixed Order of Mailboxes

This is for users who like their mailboxes in a fixed order, e.g. alphabetical, or unsorted (in the order of the config file).

    # Fixed order
    set sort_browser="alpha"
    set sort_browser="unsorted"

When you first start the browser, e.g. `c?` your current mailbox will be highlighted.

When you navigate to a parent mailbox (“..”) your old mailbox will be highlighted.

“..” will always be listed at the top, however the rest of the list is sorted.

#### 32.2.2. A Variable Order of Mailboxes

This is for users who like their mailboxes sorted by a characteristic that changes, e.g. count of new mail, or the size of mailbox.

    # Variable order
    set sort_browser="reverse-count"
    set sort_browser="reverse-size"

When you first start the browser, e.g. `c?` the highlight will be on the first mailbox, e.g. the one with the most new mail.

When you navigate to a parent mailbox (“..”) your old mailbox will be highlighted.

“..” will always be listed at the top, however the rest of the list is sorted.

### 32.3. See Also

- $folder_format

### 32.4. Known Bugs

None

### 32.5. Credits

- Pierre-Elliott Bécue `<becue@crans.org>`

- Haakon Riiser `<haakon.riiser@fys.uio.no>`

- Richard Russon `<rich@flatcap.org>`

## 33. Sidebar Feature

### Overview of mailboxes

### 33.1. Support

Since: NeoMutt 2016-09-10, NeoMutt 1.7.0

Dependencies: None

### 33.2. Introduction

The Sidebar shows a list of all your mailboxes. The list can be turned on and off, it can be themed and the list style can be configured.

This part of the manual is a reference guide. If you want a simple introduction with examples see the Sidebar Howto. If you just want to get started, you could use the sample Sidebar neomuttrc.

### 33.3. Variables

Table 6.23. Sidebar Variables

Name | Type | Default
--- | --- | ---
`sidebar_delim_chars` | string | `/.`
`sidebar_divider_char` | string | `|`
`sidebar_folder_indent` | boolean | `no`
`sidebar_format` | string | `%B%* %n`
`sidebar_indent_string` | string | `` (two spaces)
`sidebar_new_mail_only` | boolean | `no`
`sidebar_next_new_wrap` | boolean | `no`
`sidebar_on_right` | boolean | `no`
`sidebar_short_path` | boolean | `no`
`sidebar_component_depth` | number | `0`
`sidebar_sort_method` | enum | `unsorted`
`sidebar_visible` | boolean | `no`
`sidebar_width` | number | `20`

For more details, and examples, about the `$sidebar_format`, see the Sidebar Intro.

### 33.4. Functions

Sidebar adds the following functions to NeoMutt. By default, none of them are bound to keys.

Table 6.24. Sidebar Functions

Menus | Function | Description
--- | --- | ---
index,pager | `<sidebar-next>` | Move the highlight to next mailbox
index,pager | `<sidebar-next-new>` | Move the highlight to next mailbox with new mail
index,pager | `<sidebar-open>` | Open highlighted mailbox
index,pager | `<sidebar-page-down>` | Scroll the Sidebar down 1 page
index,pager | `<sidebar-page-up>` | Scroll the Sidebar up 1 page
index,pager | `<sidebar-prev>` | Move the highlight to previous mailbox
index,pager | `<sidebar-prev-new>` | Move the highlight to previous mailbox with new mail
index,pager | `<sidebar-toggle-visible>` | Make the Sidebar (in)visible

### 33.5. Commands

`sidebar_whitelist` `mailbox` [ `mailbox` ...]
`unsidebar_whitelist` { `*` | `mailbox` ... }

This command specifies mailboxes that will always be displayed in the sidebar, even if $sidebar_new_mail_only is set and the mailbox does not contain new mail.

The “unsidebar_whitelist” command is used to remove a mailbox from the list of whitelisted mailboxes. Use “unsidebar_whitelist *” to remove all mailboxes.

### 33.6. Colors

Table 6.25. Sidebar Colors

Name | Default Color | Description
--- | --- | ---
`sidebar_divider` | default | The dividing line between the Sidebar and the Index/Pager panels
`sidebar_flagged` | default | Mailboxes containing flagged mail
`sidebar_highlight` | underline | Cursor to select a mailbox
`sidebar_indicator` | neomutt `indicator` | The mailbox open in the Index panel
`sidebar_new` | default | Mailboxes containing new mail
`sidebar_ordinary` | default | Mailboxes that have no new/flagged mails, etc.
`sidebar_spoolfile` | default | Mailbox that receives incoming mail

If the `sidebar_indicator` color isn't set, then the default NeoMutt indicator color will be used (the color used in the index panel).

### 33.7. Sort

Table 6.26. Sidebar Sort

Sort | Description
--- | ---
`alpha` | Alphabetically by path
`count` | Total number of messages
`flagged` | Number of flagged messages
`name` | Alphabetically by path
`new` | Number of unread messages
`path` | Alphabetically by path
`unread` | Number of unread messages
`unsorted` | Order of the `mailboxes` command

### 33.8. neomuttrc

    # Example NeoMutt config file for the sidebar feature.

    # --------------------------------------------------------------------------
    # VARIABLES – shown with their default values
    # --------------------------------------------------------------------------
    # Should the Sidebar be shown?
    set sidebar_visible = no
    # How wide should the Sidebar be in screen columns?

    # Note: Some characters, e.g. Chinese, take up two columns each.
    set sidebar_width = 20
    # Should the mailbox paths be abbreviated?
    set sidebar_short_path = no
    # Number of top-level mailbox path subdirectories to truncate for display
    set sidebar_component_depth = 0
    # When abbreviating mailbox path names, use any of these characters as path
    # separators. Only the part after the last separators will be shown.
    # For file folders '/' is good. For IMAP folders, often '.' is useful.
    set sidebar_delim_chars = '/.'
    # If the mailbox path is abbreviated, should it be indented?
    set sidebar_folder_indent = no
    # Indent mailbox paths with this string.
    set sidebar_indent_string = '  '
    # Make the Sidebar only display mailboxes that contain new, or flagged,
    # mail.
    set sidebar_new_mail_only = no
    # Any mailboxes that are whitelisted will always be visible, even if the
    # sidebar_new_mail_only option is enabled.
    sidebar_whitelist '/home/user/mailbox1'
    sidebar_whitelist '/home/user/mailbox2'
    # When searching for mailboxes containing new mail, should the search wrap
    # around when it reaches the end of the list?
    set sidebar_next_new_wrap = no
    # Show the Sidebar on the right-hand side of the screen
    set sidebar_on_right = no
    # The character to use as the divider between the Sidebar and the other NeoMutt
    # panels.
    set sidebar_divider_char = '|'
    # Enable extended buffy mode to calculate total, new, and flagged
    # message counts for each mailbox.
    set mail_check_stats
    # Display the Sidebar mailboxes using this format string.
    set sidebar_format = '%B%?F? [%F]?%* %?N?%N/?%S'
    # Sort the mailboxes in the Sidebar using this method:
    #       count    – total number of messages
    #       flagged  – number of flagged messages
    #       new      – number of new messages
    #       path     – mailbox path
    #       unsorted – do not sort the mailboxes
    set sidebar_sort_method = 'unsorted'
    # --------------------------------------------------------------------------
    # FUNCTIONS – shown with an example mapping
    # --------------------------------------------------------------------------
    # Move the highlight to the previous mailbox
    bind index,pager \Cp sidebar-prev
    # Move the highlight to the next mailbox
    bind index,pager \Cn sidebar-next
    # Open the highlighted mailbox
    bind index,pager \Co sidebar-open
    # Move the highlight to the previous page
    # This is useful if you have a LOT of mailboxes.
    bind index,pager <F3> sidebar-page-up
    # Move the highlight to the next page
    # This is useful if you have a LOT of mailboxes.
    bind index,pager <F4> sidebar-page-down
    # Move the highlight to the previous mailbox containing new, or flagged,
    # mail.
    bind index,pager <F5> sidebar-prev-new
    # Move the highlight to the next mailbox containing new, or flagged, mail.
    bind index,pager <F6> sidebar-next-new
    # Toggle the visibility of the Sidebar.
    bind index,pager B sidebar-toggle-visible
    # --------------------------------------------------------------------------
    # COLORS – some unpleasant examples are given
    # --------------------------------------------------------------------------
    # Note: All color operations are of the form:
    #       color OBJECT FOREGROUND BACKGROUND
    # Color of the current, open, mailbox
    # Note: This is a general NeoMutt option which colors all selected items.
    color indicator cyan black
    # Color of the highlighted, but not open, mailbox.
    color sidebar_highlight black color8
    # Color of the divider separating the Sidebar from NeoMutt panels
    color sidebar_divider color8 black
    # Color to give mailboxes containing flagged mail
    color sidebar_flagged red black
    # Color to give mailboxes containing new mail
    color sidebar_new green black
    # Color to give mailboxes containing no new/flagged mail, etc.
    color sidebar_ordinary color245 default
    # --------------------------------------------------------------------------

    # vim: syntax=neomuttrc

### 33.9. See Also

- Regular Expressions

- Patterns

- Color command

- notmuch feature

### 33.10. Known Bugs

None

### 33.11. Credits

- Justin Hibbits `<jrh29@po.cwru.edu>`

- Thomer M. Gil `<mutt@thomer.com>`

- David Sterba `<dsterba@suse.cz>`

- Evgeni Golov `<evgeni@debian.org>`

- Fabian Groffen `<grobian@gentoo.org>`

- Jason DeTiberus `<jdetiber@redhat.com>`

- Stefan Assmann `<sassmann@kpanic.de>`

- Steve Kemp `<steve@steve.org.uk>`

- Terry Chan `<tchan@lunar-linux.org>`

- Tyler Earnest `<tylere@rne.st>`

- Richard Russon `<rich@flatcap.org>`

## 34. Skip Quoted Feature

### Leave some context visible

### 34.1. Support

Since: NeoMutt 2016-03-28

Dependencies: None

### 34.2. Introduction

When viewing an email, the `<skip-to-quoted>` function (by default the `S` key) will scroll past any email headers or quoted text. Sometimes, a little context is useful.

By setting the `$skip_quoted_offset` variable, you can select how much of the quoted text is left visible.

### 34.3. Variables

Table 6.27. Skip-Quoted Variables

Name | Type | Default
--- | --- | ---
`skip_quoted_offset` | number | 0

### 34.4. neomuttrc

    # Example NeoMutt config file for the skip-quoted feature.

    # The 'S' (skip-quoted) command scrolls the pager past the quoted text (usually
    # indented with '> '. Setting 'skip_quoted_offset' leaves some lines of quoted
    # text on screen for context.

    # Show three quoted lines before the reply
    set skip_quoted_offset = 3

    # vim: syntax=neomuttrc

### 34.5. Known Bugs

None

### 34.6. Credits

- David Sterba `<dsterba@suse.cz>`

- Richard Russon `<rich@flatcap.org>`

## 35. Status Color Feature

### Custom rules for theming the status bar

### 35.1. Support

Since: NeoMutt 2016-03-07

Dependencies: None

### 35.2. Introduction

The “status-color” feature allows you to theme different parts of the status bar (also when it's used by the index).

Unlike normal color commands, `color status` can now take up to 2 extra parameters (regex, num).

### 35.3. Commands

`color` `status` `foreground` `background` [ `regex` [ `num` ]]

With zero parameters, NeoMutt will set the default color for the entire status bar.

With one parameter, NeoMutt will only color the parts matching the regex.

With two parameters, NeoMutt will only color the num'th sub-match of the regex.

### 35.4. Colors

Table 6.28. Status Colors

Name | Default Color | Description
--- | --- | ---
status | `reverse` | Status bar

### 35.5. neomuttrc

    # Example NeoMutt config file for the status-color feature.

    # The 'status-color' feature allows you to theme different parts of
    # the status bar (also when it's used by the index).

    # For the examples below, set some defaults
    set status_format='-%r-NeoMutt: %f [Msgs:%?M?%M/?%m%?n? New:%n?%?o? Old:%o?%?d? Del:%d?%?F? \
      Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?%?l? %l?]---(%s/%S)-%>-(%P)---'
    set index_format='%4C %Z %{%b %d} %-15.15L (%?l?%4l&%4c?) %s'
    set sort=threads
    set sort_aux=last-date-received
    # 'status color' can take up to 2 extra parameters
    # color status foreground background [ regex [ num ]]
    # 0 extra parameters
    # Set the default color for the entire status line
    color status blue white
    # 1 extra parameter
    # Set the color for a matching pattern
    # color status foreground background regex
    # Highlight New, Deleted, or Flagged emails
    color status brightred white '(New|Del|Flag):[0-9]+'
    # Highlight mailbox ordering if it's different from the default
    # First, highlight anything (*/*)
    color status brightred default '\([^)]+/[^)]+\)'
    # Then override the color for one specific case
    color status default default '\(threads/last-date-received\)'
    # 2 extra parameters
    # Set the color for the nth submatch of a pattern
    # color status foreground background regex num
    # Highlight the contents of the []s but not the [] themselves
    color status red default '\[([^]]+)\]' 1
    # The '1' refers to the first regex submatch, which is the inner
    # part in ()s
    # Highlight the mailbox
    color status brightwhite default 'NeoMutt: ([^ ]+)' 1
    # Search for 'NeoMutt: ' but only highlight what comes after it

    # vim: syntax=neomuttrc

### 35.6. See Also

- Compile-Time Features

- Regular Expressions

- Patterns

- index-color feature

- Color command

### 35.7. Known Bugs

None

### 35.8. Credits

- David Sterba `<dsterba@suse.cz>`

- Thomas Glanzmann `<thomas@glanzmann.de>`

- Kirill A. Shutemov `<kirill@shutemov.name>`

- Richard Russon `<rich@flatcap.org>`

## 36. TLS-SNI Feature

### Negotiate with a server for a TLS/SSL certificate

### 36.1. Support

Since: NeoMutt 2016-03-07

Dependencies:

  OpenSSL

### 36.2. Introduction

The “TLS-SNI” feature adds support for TLS virtual hosting. If your mail server doesn't support this everything will still work normally.

TLS supports sending the expected server hostname during the handshake, via the SNI extension. This can be used to select a server certificate to issue to the client, permitting virtual-hosting without requiring multiple IP addresses.

This has been tested against Exim 4.80, which optionally logs SNI and can perform vhosting.

To verify TLS SNI support by a server, you can use:

    openssl s_client -host <imap server> -port <port> -tls1 -servername <imap server>

### 36.3. Known Bugs

None

### 36.4. Credits

- Jeremy Katz `<katzj@linuxpower.org>`

- Phil Pennock `<mutt-dev@spodhuis.demon.nl>`

- Richard Russon `<rich@flatcap.org>`

## 37. Trash Folder Feature

### Automatically move deleted emails to a trash bin

### 37.1. Support

Since: NeoMutt 2016-09-10, NeoMutt 1.7.0

Dependencies:

  If IMAP is enabled, the trash folder will use it wisely

### 37.2. Introduction

In NeoMutt, when you “delete” an email it is first marked deleted. The email isn't really gone until <sync-mailbox> is called. This happens when the user leaves the folder, or the function is called manually.

After `<sync-mailbox>` has been called the email is gone forever.

The $trash variable defines a folder in which to keep old emails. As before, first you mark emails for deletion. When <sync-mailbox> is called the emails are moved to the trash folder.

The `$trash` path can be either a full directory, or be relative to the $folder variable, like the `mailboxes` command.

### Note

Emails deleted from the trash folder are gone forever.

### 37.3. Variables

Table 6.29. Trash Variables

Name | Type | Default
--- | --- | ---
trash | string | (none)

### 37.4. Functions

Table 6.30. Trash Functions

Menus | Default Key | Function | Description
--- | --- | --- | ---
index,pager | (none) | `<purge-message>` | really delete the current entry, bypassing the trash folder

### 37.5. neomuttrc

    # Example NeoMutt config file for the 'trash' feature.

    # This feature defines a new 'trash' folder.

    # When mail is deleted it will be moved to this folder.

    # Folder in which to put deleted emails
    set trash='+Trash'
    set trash='/home/flatcap/Mail/Trash'
    # The default delete key 'd' will move an email to the 'trash' folder
    # Bind 'D' to REALLY delete an email
    bind index D purge-message
    # Note: Deleting emails from the 'trash' folder will REALLY delete them.

    # vim: syntax=neomuttrc

### 37.6. See Also

- folder-hook

### 37.7. Known Bugs

None

### 37.8. Credits

- Cedric Duval `<cedricduval@free.fr>`

- Benjamin Kuperman `<kuperman@acm.org>`

- Paul Miller `<paul@voltar.org>`

- Richard Russon `<rich@flatcap.org>`

Prev |  | Next
Chapter 5. NeoMutt's MIME Support | Home | Chapter 7. Security Considerations