5

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.

Matthias Braun
  • 32,039
  • 22
  • 142
  • 171
EarthIsHome
  • 655
  • 6
  • 18

2 Answers2

10

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.

Matthias Braun
  • 32,039
  • 22
  • 142
  • 171
Juancho
  • 7,207
  • 27
  • 31
  • 3
    This works. You can also use the paperclip unicode symbol 1F4CE to get Gmail look. I use the following string `%?X?& ?`. Either copy paste the symbol or in Vim to enter unicode symbols use `CTRL-V Shift-U 1F4CE`. – user3150128 Oct 18 '18 at 08:28
  • Is there a way to do the same for encrypted / signed messages? I imagine something like this: `%?S?✒️& ?` or `%?P?& ?` but these don't work... – cessor Jan 13 '20 at 09:17
  • Weird thing is, if there is indicator or color for email with attachment, the size part(%?l?%4l&%4c?) in the index goes wrong – CodyChan Mar 16 '20 at 19:37
3

To put a paper clip for an attachment, the following works for me (and also puts blanks correctly).

set index_format="%Z %?X?&  ? %{!%a %b%d'%y %I:%M:%S%p%Z}  %-12.12L  %?M?(#%03M)&(%4c)?  %?y?(%.20Y) ?%s"

I made it a bit more concise to save on screenspace...

user3236841
  • 1,088
  • 1
  • 15
  • 39