Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I discard some messages without reading them. After deleting said messages, however, I am soon alerted to the presence of unread mail in my trash can.

Is there a way to either:

  • disable the alert (set beep_new) when a new message is found in the trash can; or
  • simultaneously mark a message as read and delete it?

I imagine the former could be implemented with a trash folder hook and the latter could be implemented using a macro. However, in the case of the latter, after marking a message (Wn) or entire thread (^R) as read, the selected entry may or may not change, depending on the position of the message in the folder.

One must then use a conditional to determine how to restore the selection by use of the entry navigation commands. After restoring the selection, the message can be deleted. According to the official documentation, the configuration files do not support conditionals, so a macro-based solution might involve piping through a shell script.

Perhaps there is a simpler solution to this problem that I have overlooked?

share|improve this question

2 Answers 2

If you are enabling the option imap_check_subscribed, then all IMAP subscribed folders are automatically added to the list of mailboxes.

The command unmailboxes can be used to remove a mailbox from the list of mailboxes. So you can add the following in the .muttrc file:

push ":unmailboxes +[Gmail]/Trash<enter>"

We can't use directly the unmailboxes command because imap_check_subscribed will retrieve and add the list of mailboxes after reading the config file (.muttrc), thus we need to push it.

share|improve this answer

The obvious way is to simply not include "trash can" in the list of mailboxes that mutt checks for new mail.

i.e. don't add the trashcan folder to mailboxes.

e.g. if you generate the mailboxes list with something like:

mailboxes \
  /var/spool/mail/username \
  `find ~/Mail -type f | xargs`

then add grep -v trashcan | just before the xargs, like so:

`find ~/Mail -type f | grep -v trashcan | xargs`
share|improve this answer
I am using IMAP with a gmail account and my mailboxes line only includes my inbox (set folder = imaps://imap.gmail.com:993, mailboxes +INBOX). Do you know why other folders (e.g., trash can) are being checked for new mail? Could it be the use of the mutt-patched sidebar or the trash patch (set trash = "+[Gmail]/Trash")? Thanks. –  user001 Jul 31 '12 at 17:21
probably one of your addon patches, most likely the trash patch. I also use mutt with an imaps:// mailbox and it doesn't do what you described - I don't even get an imap Trash folder unless I specificall add one. mutt's imap support has some annoyances but that's not one of them. –  cas Jul 31 '12 at 22:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.