rss logo

The Mutt Email Client on GNU/Linux

Mutt logo

Mutt is a command-line email client for GNU/Linux. This guide covers an example of IMAP and SMTP configuration, keyboard shortcuts for sending emails and managing mailboxes, as well as message search filters.

Configuration

  • Mutt: 2.2.9

How To

Exclude Your Address from Reply-All

  • Add unset metoo to your ~/.muttrc configuration file:
user@host:~$ echo "unset metoo" >> ~/.muttrc

Enable IMAP IDLE Support

  • Add set imap_idle=yes to your ~/.muttrc configuration file:
user@host:~$ echo "set imap_idle=yes" >> ~/.muttrc

Enable Read Receipts

  • Add the header Disposition-Notification-To: <myemailaddress@domain> to your email. Press E in Mutt to edit the message with headers.

Fix “Unable to Save SSL Certificate” Error

  • Add the following lines to your ~/.muttrc configuration file:
user@host:~$ echo -e 'set imap_idle=yes\nset certificate_file="~/.mutt_certificates"' >> ~/.muttrc

Random Signature

Per Hour

  • Set the signature file in your .muttrc:
set signature="~/.signature"
  • Store all possible signatures in a file called ~/.signatures.
  • Create a cron job file at /etc/cron.d/random_signature with the following content:

This will update ~/.signature every hour with a random line from your signature list:

00 * * * * user sort -R /home/user/.signatures | head -n 1 | fold -w 72 -s > /home/user/.signature

Per Email

  • Set the signature command in .muttrc:
set signature="sort -R /home/user/.signatures | head -n 1 | fold -w 72 -s|"

Common Mutt Commands

Compose and Send an Email

  • m — Compose a new email.
  • Enter the recipient's email address and subject, then write the message in your text editor.
  • Save and close the editor to return to the compose menu.
  • t — Edit the To recipients.
  • c — Add Cc (carbon copy) recipients.
  • b — Add Bcc (blind carbon copy) recipients.
  • s — Edit the subject.
  • a — Attach a file.
  • Ctrl + T — Edit the MIME type of the selected attachment.
  • y — Send the email.

Mail Navigation and Actions

y List Mailboxes — Display available mailboxes
c Change Folder — Open a different mailbox folder
b Bounce Message — Redirect the current message to another recipient without modifying the original message headers
* Last Entry — Jump to the last entry in the current menu
= First Entry — Jump to the first entry in the current menu

Organize Mailboxes

  • Create an IMAP Folder:
    • c — Change folder
    • ? — Browse folders
    • C — Create a new mailbox
  • Delete an IMAP Folder:
    • c — Change folder
    • ? — Browse folders
    • d — Delete the selected mailbox
  • Rename an IMAP Folder:
    • c — Change folder
    • ? — Browse folders
    • r — Rename the selected mailbox
  • Move or Copy a Message to Another Folder:
    • s — Move the current message
    • C — Copy the current message
  • Move Multiple Messages:
    • t — Tag the messages to move
    • ; — Apply the next command to tagged messages
    • s — Move the tagged messages
  • IMAP: Subscribe or Unsubscribe from a Folder:
    • c — Change folder
    • ? — Browse folders
    • T — Toggle between all and subscribed folders
    • u — Unsubscribe from the selected folder
    • s — Subscribe to the selected folder

In an IMAP environment, replace ~ with = to improve search performance.

  • Show only emails from a specific sender
    • l — Limit messages
    • ~f toto@domaine.local
  • Show emails from a specific date range
    • l — Limit messages
    • ~d 01/01/2018-31/12/2018
  • Show emails from multiple senders and a date range
    • l — Limit messages
    • (~f toto|~f titi) ~d 01/01/2018-31/12/2018
  • Show emails matching a subject
    • l — Limit messages
    • ~s "Elarge your P"
  • Show all emails
    • l — Limit messages
    • all
  • Search for an expression in the message body
    • l — Limit messages
    • ~b EXPR
  • Search for an expression in the full message
    • l — Limit messages
    • ~B EXPR

Configuration File Example

The following settings go in your ~/.muttrc file:

# basic configuration
set realname = "Firstname LASTNAME"
set header_cache =~/.mutt/cache/headers
#set message_cachedir =~/.mutt/cache/bodies
set certificate_file="~/.mutt_certificates"

# imap configuration
set folder="imaps://imap.shebangthedolphins.net:993"
set spoolfile="+INBOX"
set record="+INBOX.Sent"
set imap_user = "user@shebangthedolphins.net"
set imap_pass = "IMAP_password"
set imap_passive="no"
set imap_check_subscribed="yes"
set imap_list_subscribed="yes"
set ssl_starttls=yes
# Automatically poll subscribed mailboxes for new mail (new in 1.5.11)
set imap_check_subscribed
# Reduce polling frequency to a sane level
set mail_check=60

# SMTP configuration
set smtp_url = "smtps://user@shebangthedolphins.net@smtp.shebangthedolphins.net:465/" #with usershebangthedolphins.net as our SMTP user login
set smtp_pass = "SMTP_password"
set from = "user@shebangthedolphins.net"
set use_envelope_from=yes # Use the configured From address as the envelope sender.

#address book
#set alias_file = ~/.mutt/adresses
#source ~/.mutt/adresses

set implicit_autoview 
set editor=/usr/bin/vim
auto_view text/html application/x-pgp-message 
set mailcap_path="~/.mailcap" 
set mailcap_sanitize=yes
unset metoo   # Exclude your own address when replying to all recipients.
#set signature="~/.mutt/signature"

# enable IMAP IDLE
set imap_idle=yes

#disable SSL3
set ssl_use_sslv3=no