MB(1) User Manuals MB(1) NAME mb - a simple mailbox utility SYNOPSIS mb --help mb --list mb [--maildir dir] mb [--maildir dir] --uid uid mb [--maildir dir] --uid uid [--toggle flags] [--set flags] [--unset flags] DESCRIPTION mb is a simple utility for basic operations on mail stored in the maildir format. It is intended to be used in scripts, but it should be useable by itself. The program has five main modes of operation, corresponding to the five lines in the SYNOPSIS above: * Show help message and exit * List directories which may contain mail * Tabulate mail from the specified directory * Print the path of an message * Modify the flags of an message and print the new path OPTIONS -h, --help Show help message and exit. -l, --list List sub-directories (recursive) of the MAIL ROOT that follow the MAILDIR STRUCTURE. -d dir, --maildir dir Look for mail in dir. If not specified, defaults to INBOX. Can be either: an absolute path, a path rel‐ ative to the current directory, or a path relative to the MAIL ROOT. -u uid, --uid uid Look for an message with the following uid. See also: FILENAMES. -t flags, --toggle flags Toggle the following flags on the specified mes‐ sage. See also: FLAGS. -f flags, --set flags Set the following flags on the specified message. See also: FLAGS. -F flags, --unset flags Unset the following flags on the specified message. See also: FLAGS. DIRECTORY STRUCTURE mb assumes the following directory structure: MAIL ROOT Directories may be specified as relative to the MAIL ROOT. To find the MAIL ROOT, mb tries the following: * ~/.local/share/mail/ * ~/mail/ * ~/Mail/ MAILDIR STRUCTURE Directories containing mail are expected to contain the following sub- directories. Each message is stored in a separate file in one of these sub-directories. tmp/ Contains email as it is being downloaded. Ignored but still re‐ quired. new/ Contains email that has not yet been seen. None of these should have the S flag. cur/ Contains email that has been seen. All of these should have the S flag. FILENAMES Files are expected to be named according to the following format unique-name,U=uid:2,flags Where unique-name is ignored, uid is a positive integer that is unique to each message in the MAILDIR, and flags is a (possibly empty) string where each character specifies a flag. (see below) Although the MAILDIR spec allows for a wider variety of filenames, I have chosen to expect a format like that used by mbsync in order to simplify refering to specific messages. FLAGS The table below lists the recognised flags. Any flags not on this list are ignored and may be deleted. As flags are stored as part of the filename, changing the flags for a message also changes the filename. D Draft F Flagged R Replied S Seen T Trash SEE ALSO mbsync(1), maildir(5) Source code available at https://github.com/Benjamin-Davies/mb. AUTHOR mb was written by Benjamin Davies <bentendavies@gmail.com> and is li‐ censed under GPLv3.0. mb 0.1 2020-08-29 MB(1)