Search code examples
mutt

Show if a message in the mutt index has an attachment


Is there a way to have Mutt's index show if a message has an attachment?

This would be similar to how Gmail shows a paperclip next to messages with an attachment.

I can limit the messages with attachments using ~X 1-15, but it's nice to see whether messages have an attachment in the index.


Solution

  • You can add the number of attachments (%X) to the index format setting.

    For example, this shows the number of attachments after the status flags:

    set index_format="%4C %Z %X %{%y%m%d} %-12.12L %?M?(#%03M)&(%4c)? %?y?(%.20Y) ?%s"
    

    Or, if you only want an indicator, you can use conditionals. If instead of %X you put %?X?A&-?, you'll get A for messages with attachments, and - for messages without.

    Search for the chapter Format strings in the supplied documentation.