Mutt Cheat Sheet – How to delete all message in Mutt

Background

Mutt is a basic Linux terminal based email client.

Why Mutt?

One might ask why use a terminal based email client when such a wealth of highly feature rich web based email client software already exists? Let me give you one reason: As a server administrator, you need to see messages sent to root. Often on a dedicated or VPS hosted service, the operating system will spurn messages to root@localhost if it deems the messages to be important. These critical messages often contain extremely valuable troubleshooting information that will be found nowhere else.

Read-only Problem on Silicon Mac

dseditgroup -o edit -u username -p -a username -t user mail

See comments at: https://superuser.com/questions/631015/mailbox-is-always-read-only-in-mutt

Mutt on Mac and does not exist

When you start Mac on Mutt, you might get this caveat:

/Users/username/Mail does not exist. Create it? ([yes]/no):

This is a problem. You don’t want it. Just say no.

How to configure Mutt to use Maildir

Mutt relies on a file called ~/.muttrc

If Mutt was started and defaulted to the wrong format, you can reconfigure it by creating a new ~/.muttrc file with chmod 600 permissions. The contents of the file should be this:

set mbox_type=Maildir
set spoolfile="~/Maildir/"
set folder="~/Maildir/"
set mask=".*"
set record="+.Sent"
set postponed="+.Drafts"
# Generate mailboxes for each maildir subdir
mailboxes ! + `\
for file in ~/Maildir/.*; do \
  box=$(basename "$file"); \
  if [ ! "$box" = '.' -a ! "$box" = '..' -a ! "$box" = '.customflags' \
      -a ! "$box" = '.subscriptions' ]; then \
   echo -n "\"+$box\" "; \
  fi; \
done`
# Marcos to display folder list when changing maildir folders
macro index c "<change-folder>?<toggle-mailboxes>" "open a different folder"
macro pager c "<change-folder>?<toggle-mailboxes>" "open a different folder"
# Macros to display folder list when copying/moving messages
macro index C "<copy-message>?<toggle-mailboxes>" "copy a message to a mailbox"
macro index M "<save-message>?<toggle-mailboxes>" "move a message to a mailbox"

Reference: https://r-pufky.github.io/docs/apps/mutt.html

Delete all messages?

System generated error and other message sent to Mutt will build up over time. If you don’t log in regularly and clean up, you might end up with thousands of messages eventually.

Emails messages to root can be transient, and only really important when they happen. When you have 1000s it’s impossible to focus on the most important ones.

This article will help you to solve the problem of deleting many messages at once.

Steps to delete all messages

1. Start mutt from the command line.

2. Press SHIFT-D (uppercase d). The status bar of mutt should show:

Delete messages matching:

3. Type in ~s .* in the status bar and press enter

4. Press q to quit, and then y to confirm the deletion of all messages.

Reference

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top