LinuxCommandLibrary

mu

Manage and search email messages

TLDR

Initialize the email database, optionally specifying the Maildir directory and email addresses

$ mu init --maildir=[path/to/directory] --my-address=[name@example.com]
copy

Index new emails
$ mu index
copy

Find messages using a specific keyword (in message body, subject, sender, ...)
$ mu find [keyword]
copy

Find messages to Alice with subject jellyfish containing the words apples or oranges
$ mu find to:[alice] subject:[jellyfish] [apples] OR [oranges]
copy

Find unread messages about words starting with soc (the * only works at the end of the search term) in the Sent Items folder
$ mu find 'subject:[soc]*' flag:[unread] maildir:'/[Sent Items]'
copy

Find messages from Sam with attached images, between 2 KiB and 2 MiB, written in 2021
$ mu find 'mime:[image/*] size:[2k..2m] date:[20210101..20211231] from:[sam]
copy

List contacts with Bob in either name or email address
$ mu cfind [Bob]
copy

SYNOPSIS

mu [GENERAL_OPTIONS] [SUBCOMMAND_OPTIONS] [ARGUMENTS]

Common Subcommands:
mu index [OPTIONS]
mu find [OPTIONS] [QUERY_TERMS]
mu view [OPTIONS] [MESSAGE_IDS]
mu extract [OPTIONS] [MESSAGE_IDS]

PARAMETERS

--config
    Use a different configuration file than the default.

-d, --debug
    Show debug messages; useful for troubleshooting.

-h, --help
    Show general help message or help for a specific subcommand.

-q, --quiet
    Do not output warnings or other information.

--terminate
    Used internally for communication with other processes, e.g., to report progress.

-v, --version
    Show version information and exit.

DESCRIPTION

mu is a powerful and versatile command-line utility designed for indexing and searching email messages stored in the Maildir format. It provides a fast, accurate, and easy-to-use search engine for your email collection. Primarily built for integration with email clients like Emacs' mu4e and Vim, mu can also be used directly from the shell for various tasks. It indexes message headers and bodies, allowing for complex queries based on sender, recipient, subject, body content, dates, and more. mu aims to provide a robust solution for managing large email archives efficiently, enabling users to quickly locate specific emails or analyze their mail corpus. Its core strength lies in its speed and its comprehensive indexing capabilities, making it an essential tool for many power users managing their mail locally.

CAVEATS

mu is primarily designed for Maildir format mailboxes and may not directly support other formats like mbox without prior conversion. Performance can be significantly affected by disk I/O speed and the size of the Maildir, especially during initial indexing. While powerful, some advanced search functionalities might require familiarity with `mu`'s specific query syntax. It relies on a properly configured Maildir structure and a functional Xapian search engine backend.

QUERY SYNTAX

`mu` uses a powerful query syntax that supports Boolean operators (`AND`, `OR`, `NOT`), wildcards (`*`), grouping with parentheses, and field-specific searches (e.g., `from:sender`, `subject:keyword`, `date:today`). This allows for highly precise and flexible searches.

INTEGRATION WITH EMACS (<I>MU4E</I>)

One of `mu`'s most popular use cases is its integration with Emacs through the mu4e mail client. mu4e provides a complete, fast, and feature-rich email environment within Emacs, leveraging `mu` for all indexing, searching, and viewing operations.

MAILDIR FORMAT

`mu` specifically targets the Maildir format, which stores each email message in a separate file, making it robust against data corruption and easy to manage with standard file system tools. Ensure your mail is stored in this format for `mu` to work effectively.

HISTORY

`mu` was created by Dirk-Jan C. B. H. ten Oever as a maildir indexer and search tool, initially released around 2009. It was conceived to provide a fast and reliable way to search large email collections, especially for users who prefer command-line tools or Emacs (leading to the development of mu4e, an Emacs client for `mu`). Its development has been driven by the need for efficient local email management, leveraging the Xapian search engine library for its powerful indexing and querying capabilities. Over the years, `mu` has seen continuous development, adding new subcommands and refining existing functionalities to handle diverse email management tasks.

SEE ALSO

notmuch(1), mutt(1), grep(1), mail(1)

Copied to clipboard