### GPG List Keys Example Source: https://neomutt.org/guide/reference.html Example command for listing keys with specific formatting, used as a reference for NeoMutt PGP commands. ```bash gpg --list-keys --with-colons --with-fingerprint ``` -------------------------------- ### Sidebar Format Examples Source: https://neomutt.org/guide/gettingstarted Examples of how different format strings render mailbox information in the sidebar. ```text mailbox [F] N/S ``` ```text mailbox F:N:S ``` ```text mailbox (N) S ``` ```text mailbox F/S ``` -------------------------------- ### Set up SSH preconnect for secure server connections Source: https://neomutt.org/guide/reference.html Use this to execute a shell command if NeoMutt fails to connect to the server. It's useful for establishing secure connections, for example, with ssh(1). If the command returns a non-zero status, NeoMutt will give up opening the server. Note: For this example to work, you must be able to log in to the remote machine without a password. ```shell set preconnect="ssh -f -q -L 1234:mailhost.net:143 mailhost.net \ sleep 20 < /dev/null > /dev/null" ``` -------------------------------- ### Standard Mailcap Configuration Source: https://neomutt.org/guide/mimesupport A basic example of a standard mailcap file for handling video and image types. ```text # I'm always running X :) video/*; xanim %s > /dev/null image/*; xv %s > /dev/null # I'm always running firefox (if my computer had more memory, maybe) text/html; firefox -remote 'openURL(%s)' ``` -------------------------------- ### Secure Mailcap Example with Shell Variable Source: https://neomutt.org/guide/mimesupport An advanced mailcap example demonstrating secure handling of shell meta-characters by using a shell variable for charset. ```mailcap text/test-mailcap-bug; cat %s; copiousoutput; test=charset=%{charset} \ && test "`echo $charset | tr '[A-Z]' '[a-z]'`" != iso-8859-1 ``` -------------------------------- ### Example NeoMutt URLs Source: https://neomutt.org/guide/optionalfeatures.html Illustrates various ways to specify URLs for POP3 and IMAP access, including secure connections, usernames, and paths. ```text pops://host/ ``` ```text imaps://user@host/INBOX/Sent ``` ```text smtp://user@host:587/ ``` -------------------------------- ### Expand Content-Type Parameters Source: https://neomutt.org/guide/mimesupport Example of a Content-Type header that allows NeoMutt to expand parameters like %{charset}. ```text Content-Type: text/plain; charset=iso-8859-1 ``` -------------------------------- ### Example Query Response Output Source: https://neomutt.org/guide/advancedusage.html Format for the output returned by the external query wrapper script. ```text Searching database ... 70 entries ... 5 matching: ji@papaya.com Jeremy Irons Emmy, Oscar, Tony jc@damson.com James Cagney Oscar mr@ilama.com Meg Ryan mjf@kumquat.com Michael J Fox ma@yew.com Murray Abraham Oscar ``` -------------------------------- ### Example notmuch query window configuration Source: https://neomutt.org/guide/reference.html Demonstrates how to combine mailbox queries with additional search terms for messages regardless of date. This is useful for creating dynamic search windows. ```text notmuch://?query=tag:inbox and (date:... or (tag:flagged and tag:unread)) ``` -------------------------------- ### Comprehensive Mailcap Configuration Examples Source: https://neomutt.org/guide/mimesupport Various mailcap configurations for handling video, HTML, text, and image attachments with different conditions and flags. ```text # Use xanim to view all videos Xanim produces a header on startup, # send that to /dev/null so I don't see it video/*; xanim %s > /dev/null # Send html to a running firefox by remote text/html; firefox -remote 'openURL(%s)'; test=RunningFirefox # If I'm not running firefox but I am running X, start firefox on the # object text/html; firefox %s; test=RunningX # Else use lynx to view it as text text/html; lynx %s # This version would convert the text/html to text/plain text/html; lynx -dump %s; copiousoutput # I use enscript to print text in two columns to a page text/*; more %s; print=enscript -2Gr %s # Firefox adds a flag to tell itself to view jpegs internally image/jpeg; xv %s; x-mozilla-flags=internal # Use xv to view images if I'm running X # In addition, this uses the \ to extend the line and set my editor # for images image/*; xv %s; test=RunningX; edit=xpaint %s # Convert images to text using the netpbm tools image/*; (anytopnm %s | pnmscale -xysize 80 46 | ppmtopgm | pgmtopbm | \ pbmtoascii -1x2) 2>&1 ; copiousoutput # Send excel spreadsheets to my NT box application/ms-excel; open.pl %s ``` -------------------------------- ### Alias Example Source: https://neomutt.org/guide/reference.html Demonstrates how an alias with a personal name is displayed in the index menu when a matching email address is received. This is useful for human-friendly display of email addresses. ```text alias juser abd30425@somewhere.net (Joe User) From: abd30425@somewhere.net ``` -------------------------------- ### Control Temporary File Lifespan Source: https://neomutt.org/guide/mimesupport Examples showing how to control whether NeoMutt waits for a program to finish or deletes temporary files. ```text # The `display` program shows an image and doesn't return until the user quits. # Display an image, but wait for the user to quit the display program. # When the user quits control will return to NeoMutt. image/png; display %s; # Display an image and return to NeoMutt immediately. image/png; display %s &; # The file will be automatically deleted after $timeout seconds. ``` ```text # Some graphical programs return immediately if they're already running. # We'll add an ampersand (&), just in case they're not. # View the contents of a 'tar' file. # The file will be automatically deleted after $timeout seconds. application/x-tar; file-roller %s &; # View the contents of a 'tar' file. # The file will _not_ be deleted. application/x-tar; file-roller %s &; x-neomutt-keep ``` ```text # Some programs watch any files they have open. # If NeoMutt deleted the file, the program would close prematurely. ``` -------------------------------- ### Configure MIME Types with mime.types Source: https://neomutt.org/guide/mimesupport Define file extension to MIME type mappings in the mime.types file. Each line starts with the MIME type, followed by space-separated file extensions. ```text application/postscript ps eps application/pgp pgp audio/x-aiff aif aifc aiff ``` -------------------------------- ### Define Mailcap Print Entries Source: https://neomutt.org/guide/mimesupport Example of specifying print commands for different MIME types in a mailcap file. ```text image/*; xv %s image/gif; ; print=anytopnm %s | pnmtops | lpr; \ nametemplate=%s.gif ``` -------------------------------- ### Gmail Search Patterns Source: https://neomutt.org/guide/advancedusage.html Examples of using the =/ operator to perform server-side searches in Gmail folders. ```text =/ "list:foo.example.org has:attachment is:important" ``` ```text =/ "{has:purple-star has:yellow-star} older_than:2m" ``` -------------------------------- ### NeoMutt Sidebar Visual Output Source: https://neomutt.org/guide/gettingstarted Example representation of the sidebar layout showing mailboxes on the left and email lists on the right. ```text Fruit [1] 3/8| 1 + Jan 24 Rhys Lee (192) Yew Animals [1] 2/6| 2 + Feb 11 Grace Hall (167) Ilama Cars 4| 3 Feb 23 Aimee Scott (450) Nectarine Seas 1/7| 4 ! Feb 28 Summer Jackson (264) Lemon | 5 Mar 07 Callum Harrison (464) Raspberry | 6 N + Mar 24 Samuel Harris (353) Tangerine | 7 N + Sep 05 Sofia Graham (335) Cherry | 8 N Sep 16 Ewan Brown (105) Ugli | | ``` ```text Fruit [1] 3/8| 1 Jan 03 Tia Gibson (362) Caiman Animals [1] 2/6| 2 + Jan 22 Rhys Lee ( 48) Dolphin Cars 4| 3 ! Aug 16 Ewan Brown (333) Hummingbird Seas 1/7| 4 Sep 25 Grace Hall ( 27) Capybara | 5 N + Nov 12 Evelyn Rogers (453) Tapir | 6 N + Nov 16 Callum Harrison (498) Hedgehog | | | | ``` ```text Fruit [1] 3/8| 1 Jan 03 Tia Gibson (362) Caiman Animals [1] 2/6| 2 + Jan 22 Rhys Lee ( 48) Dolphin Cars 4| 3 ! Aug 16 Ewan Brown (333) Hummingbird Seas 1/7| 4 Sep 25 Grace Hall ( 27) Capybara | 5 N + Nov 12 Evelyn Rogers (453) Tapir | 6 N + Nov 16 Callum Harrison (498) Hedgehog | | | | ``` ```text Fruit [1] 3/8| 1 ! Mar 07 Finley Jones (139) Molucca Sea Animals [1] 2/6| 2 + Mar 24 Summer Jackson ( 25) Arafura Sea Cars 4| 3 + Feb 28 Imogen Baker (193) Pechora Sea Seas 1/7| 4 N + Feb 23 Isla Hussain (348) Balearic Sea | | | | | | ``` -------------------------------- ### Custom Mailcap File Entry Source: https://neomutt.org/guide/mimesupport Example of a mailcap entry using a custom script to manage file lifespan. ```text application/pdf; my-pdf-script.sh %s; x-neomutt-keep ``` -------------------------------- ### Set Compose Header Color Source: https://neomutt.org/guide/configuration.html Configure the color and style for compose window header labels. This example makes them bold white. ```neomutt color compose_header bold white default ``` -------------------------------- ### Create address groups implicitly with 'alternates' Source: https://neomutt.org/guide/configuration.html Address groups can be created implicitly by commands like 'alternates' using the '-group' option. This example shows creating a 'me' group and a 'work' group. ```shell alternates -group me address1 address2 alternates -group me -group work address3 ``` -------------------------------- ### Set inews_command for Mail Delivery Source: https://neomutt.org/guide/reference.html Specifies the program and arguments used to deliver news posted by NeoMutt. This example sets the inews command to use a specific path. ```neomutt set inews_command="/usr/local/bin/inews -hS" ``` -------------------------------- ### Using \s and matching a literal dot in patterns Source: https://neomutt.org/guide/advancedusage.html Demonstrates how to use \s for whitespace and match literal dots within patterns, showing examples with no quotes, single quotes, and double quotes. Pay attention to backslash escaping for regular expressions. ```neomutt # no quotes save-hook ~h\ list-id:\\s* '=archive' save-hook ~hlist-id:\\s* '=archive' # single quotes save-hook '~h list-id:\s' '=archive' save-hook ~h'list-id:\s*' '=archive' # Double quotes save-hook "~h list-id:\\s" '=archive' save-hook ~h"list-id:\\s*" '=archive' ``` -------------------------------- ### Set tunnel for remote connections Source: https://neomutt.org/guide/reference.html Configure NeoMutt to use a pipe to a command for remote connections, useful for preauthenticated connections. Ensure passwordless login to the remote machine for this example to work. ```shell set tunnel="ssh -q mailhost.net /usr/local/libexec/imapd" ``` -------------------------------- ### RFC2047 Encoded MIME Parameters Source: https://neomutt.org/guide/reference.html Shows examples of RFC2047-encoded MIME parameters for attachment filenames. This setting is useful when dealing with filenames encoded in non-standard ways, often produced by clients like Outlook. ```text =?iso-8859-1?Q?file=5F=E4=5F991116=2Ezip?= =?utf-8?Q?z=C4=99ta.png?= ``` -------------------------------- ### Configuring Default Hooks Source: https://neomutt.org/guide/advancedusage.html Demonstrates setting a default hook to reset configuration settings before applying specific hooks. ```text send-hook . 'unmy-header From:' send-hook ~C'^b@b\.b$' my-header from: c@c.c ``` -------------------------------- ### Type Conversion Limitation Example Source: https://neomutt.org/guide/configuration.html Illustrates a limitation where a variable's value is treated as a single token during expansion. This example shows that a space-separated string assigned to a variable does not automatically split into multiple arguments for commands expecting multiple arguments. ```neomutt set my_mx = "+mailbox1 +mailbox2" mailboxes $my_mx +mailbox3 ``` -------------------------------- ### Set multiple configuration commands per line Source: https://neomutt.org/guide/configuration.html Use a semicolon to separate multiple commands on a single line within an initialization file. ```text set real_name='John Smith' ; ignore x- ``` -------------------------------- ### Absolute Date Range Search in NeoMutt Source: https://neomutt.org/guide/advancedusage.html Searches for messages within a specified date range using DD/MM/YY or YYYYMMDD format. Omitting the start date searches before the end date, and omitting the end date searches after the start date. ```neomutt Limit to messages matching: ~d 20/1/95-31/10 Limit to messages matching: ~d 19950120-19951031 ``` -------------------------------- ### View HTML with 'lynx' and other text with 'more' Source: https://neomutt.org/guide/mimesupport Set up NeoMutt to use 'lynx' for HTML files and 'more' for all other text formats. ```mailcap text/html; lynx %s text/*; more ``` -------------------------------- ### Set Variable with Prompt Options Source: https://neomutt.org/guide/configuration.html Set a quadoption variable to control prompting behavior. 'ask-yes' and 'ask-no' provide default answers. ```neomutt set quadoption_variable=ask-yes ``` ```neomutt set quadoption_variable=ask-no ``` -------------------------------- ### View HTML with 'lynx' (file) Source: https://neomutt.org/guide/mimesupport Configure NeoMutt to use 'lynx' to view HTML content, saving it to a temporary file first. ```mailcap text/html; lynx %s ``` -------------------------------- ### Mbox Message Separator Source: https://neomutt.org/guide/advancedusage.html The standard From_ line used to denote the start of a new message in mbox format. ```text From me@ox.ac.uk Fri, 11 Apr 1997 11:44:56 PST ``` -------------------------------- ### Avoiding Binding Warnings Source: https://neomutt.org/guide/configuration.html Methods to prevent startup warnings when creating overlapping key bindings. ```text bind index g noop bind index gg first-entry ``` ```text unbind index g bind index gg first-entry ``` -------------------------------- ### Launch NeoMutt with mailto URL Source: https://neomutt.org/guide/reference.html This command demonstrates launching NeoMutt using a mailto URL, which includes recipient, subject, and CC fields. Ensure the '-a' option, if used, is the last argument. ```bash neomutt mailto:some@one.org?subject=test&cc=other@one.org ``` -------------------------------- ### Create a Key Macro Source: https://neomutt.org/guide/configuration.html Define a macro to execute a sequence of commands with a single key press. Macros can be bound to specific maps and include descriptions. ```neomutt macro index,compose "gG" "toggle all tags" ``` -------------------------------- ### Add comments to configuration files Source: https://neomutt.org/guide/configuration.html Use the hash mark (#) to annotate configuration files; all text following the character on the same line is ignored. ```text my-header X-Disclaimer: Why are you listening to me? ``` -------------------------------- ### Example Multipart/Related Email Structure Source: https://neomutt.org/guide/mimesupport A visual representation of a multipart/related email structure containing alternative text/html parts, an embedded image, and a separate attachment. ```text I 1 [multipart/related, 7bit, 0K] I 2 ├─> [multipart/alternative, 7bit, 0K] - I 3 │ ├─>/tmp/neomutt-hostname-XXXX-XXXXXX-XXXXXXXXXX [text/plain, 7bit, us-ascii, 0.1K] - I 4 │ └─>/tmp/neomutt-alternative.html [text/html, 8bit, utf-8, 0.6K] I 5 └─>image.png [image/png, base64, 19K] A 6 attachment.pdf [application/pdf, quoted, 7.1K] ``` -------------------------------- ### Matching restricted to aliases Source: https://neomutt.org/guide/advancedusage.html This example restricts address pattern matching to only those aliases defined in your configuration. It matches messages where all recipients are from Germany and are known aliases. ```neomutt ^@~C \.de$ ``` -------------------------------- ### Absolute Message Number Ranges Source: https://neomutt.org/guide/advancedusage.html Provides examples of absolute message number ranges (MNR) when no comma is present. These ranges specify fixed message numbers or boundaries. ```neomutt ~m 3-10 ``` ```neomutt ~m -10 ``` ```neomutt ~m 10- ``` ```neomutt ~m <3 ``` ```neomutt ~m ^-2 ``` ```neomutt ~m >1 ``` ```neomutt ~m 2-$ ``` ```neomutt ~m 2 ``` -------------------------------- ### Using External Command Output in NeoMutt Configuration Source: https://neomutt.org/guide/configuration.html Enclose a Unix command in backticks to substitute its output into a configuration line. Only the first line of output is used. ```neomutt my-header X-Operating-System: `uname -a` ``` -------------------------------- ### POP server connection string format Source: https://neomutt.org/guide/reference.html Defines the format for specifying POP server details, including optional port, username, and password. ```neomutt [pop[s]://][username[:password]@]popserver[:port] ``` -------------------------------- ### Preventing Mailto Link Attachments Source: https://neomutt.org/guide/security.html This example demonstrates a mailto link that attempts to attach a sensitive file. NeoMutt by default restricts allowed headers to prevent such issues. ```plaintext mailto:joe@host?Attach=~/.gnupg/secring.gpg ``` -------------------------------- ### View Plain Text with 'more' (file) Source: https://neomutt.org/guide/mimesupport Configure NeoMutt to save plain text content to a temporary file and pass its name to the 'more' command. ```mailcap text/plain; more %s ``` -------------------------------- ### Add Key Sequences to Keyboard Buffer Source: https://neomutt.org/guide/configuration.html The push command adds a string to the beginning of the keyboard buffer. Use angle brackets for function names (e.g., ) to ensure they are recognized as functions rather than literal keystrokes. This is useful for automating commands at startup or when entering specific folders. ```neomutt folder-hook . 'push ' ``` ```neomutt folder-hook . 'push \eV' ``` -------------------------------- ### Configure folder-hooks with mailbox shortcuts Source: https://neomutt.org/guide/advancedusage.html Demonstrates how to handle mailbox shortcut expansion in folder-hook regex patterns using parentheses or backslashes to avoid unintended expansion. ```neomuttrc # Here, ^ will expand to "the current mailbox" not "beginning of string": folder-hook ^/home/user/Mail/bar "set sort=threads" # If you want ^ to be interpreted as "beginning of string", one workaround # is to enclose the regex in parenthesis: folder-hook (^/home/user/Mail/bar) "set sort=threads" # This will expand to the default save folder for the alias "imap.example.com", which # is probably not what you want: folder-hook @imap\.example\.com "set sort=threads" # A workaround is to use parenthesis or a backslash: folder-hook (@imap\.example\.com) "set sort=threads" folder-hook '\@imap\.example\.com' "set sort=threads" ``` -------------------------------- ### Overwriting Key Bindings Source: https://neomutt.org/guide/configuration.html Demonstrates how shorter key bindings are overwritten by longer ones in NeoMutt. ```text bind index g group-reply bind index gg first-entry ``` -------------------------------- ### Execute NeoMutt Functions Source: https://neomutt.org/guide/configuration.html The exec command executes specified functions, equivalent to using push with the function name enclosed in angle brackets (e.g., push ). Refer to the function reference for a list of available functions. ```neomutt exec function ``` -------------------------------- ### Search with Whitespace and Grouped OR in NeoMutt Source: https://neomutt.org/guide/advancedusage.html Example of searching with whitespace in regular expressions and using grouped OR conditions for sender fields. Requires quoting due to special characters like parentheses and vertical bars. ```neomutt '~s "^Junk +From +Me$" ~f ("Jim +Somebody"|"Ed +SomeoneElse")' ``` -------------------------------- ### Configure Manual Crypto Functions (Classic Mode) Source: https://neomutt.org/guide/gettingstarted Disable GPGME and configure manual crypto commands for advanced or specific encryption needs. This is often referred to as 'classic mode'. ```neomutt # Use manual crypto functions unset crypt_use_gpgme set pgp_clear_sign_command = "..." ... set smime_decrypt_command = "..." ... ``` -------------------------------- ### List Public Key Ring Command Source: https://neomutt.org/guide/reference.html Command to list the contents of the public key ring. Output format should be analogous to 'gpg --list-keys --with-colons --with-fingerprint'. ```neomutt_config set pgp_list_pubring_command = "" ``` -------------------------------- ### Configure external alias files Source: https://neomutt.org/guide/configuration.html Source external files for aliases and set the primary alias file for the create-alias function. ```neomuttrc source /usr/local/share/NeoMutt.aliases source ~/.mail_aliases set alias_file=~/.mail_aliases ``` -------------------------------- ### View Plain Text with 'more' (stdin) Source: https://neomutt.org/guide/mimesupport Configure NeoMutt to pipe plain text content to the 'more' command via standard input. ```mailcap text/plain; more ``` -------------------------------- ### Reset All Variables to Default Source: https://neomutt.org/guide/configuration.html Reset all configuration variables to their system defaults. ```neomutt reset all ``` -------------------------------- ### Configure NeoMutt Color Schemes Source: https://neomutt.org/guide/configuration.html Use the color command to define foreground and background colors for specific interface objects. The default keyword allows for transparent color settings. ```neomutt # Make error messages white text on a red background color error default red color error white default ``` -------------------------------- ### Attach multiple files Source: https://neomutt.org/guide/reference.html Use the -a option with a wildcard to attach multiple files. Separate attachments and recipients with '--'. ```bash neomutt -a *.png -- some@one.org ```