6

Indicating the presence of attachments

In mutt, I can tell an email has an attachment because it is indicated in the email's display itself:

[-- Attachment #1 --]
[-- Type: text/plain, Encoding: quoted-printable, Size: 0.3K --]

body text here

[-- Attachment #2: IMG_1234.JPG --]
[-- Type: image/jpeg, Encoding: base64, Size: 682K --]

[-- image/jpeg is unsupported (use 'v' to view this part) --]

I've also created a colour scheme to highlight these entries in the index (although I am forced to use the arrow cursor). In my muttrc:

color index green color231 "~X 1-"

Doesn't always work

However, sometimes emails with attachments are not indicated in the email display, nor highlighted in the index. These emails are structured as follows, after pressing v:

->   I     1 <no description>                          [multipa/alternativ, 7bit, 12M]
     I     2 ├─><no description>                    [text/plain, 7bit, us-ascii, 0.1K]
     I     3 └─><no description>                          [multipa/related, 7bit, 12M]
     I     4   ├─><no description>                 [text/html, quoted, us-ascii, 1.4K]
     I     5   ├─>IMG_1234.jpeg                             [image/jpeg, base64, 3.9M]
     I     6   ├─>IMG_1235.jpeg                             [image/jpeg, base64, 1.4M]
     I     7   ├─>IMG_1236.jpeg                             [image/jpeg, base64, 3.0M]
     I     8   └─>IMG_1237.jpeg                             [image/jpeg, base64, 4.4M]

This example was created in Apple Mail. Possibly this is a bug with this client. Nevertheless, how can I make mutt indicate the presence of attachments? I've missed some attachments as a consequence.

What I've tried

One possible option that I explored was to highlight all emails above some arbitrary size, but this obviously doesn't work in all cases (and doesn't indicate the attachments in the email display itself).

color index green color231 "~z 30K-"
3

Rather than colours I just use the index_format string to show the presence of attachments, like this:

set index_format = "[%Z][%?X?A& ?] %D %-20.20F %s %g"

The %?X?A& ? is a ternary which says if the email has nonzero attachments then show the character "A", else show " ". You could actually show the number of attachments but I generally just care if there are any, or none.

  • Thanks for the answer. However, it still fails in the above example, which is the main thrust of my question. – Sparhawk May 7 '16 at 5:09
  • Oh interesting, never encountered that problem but sounds like something that should be handled... prob have to dig into how mutt figures out what an "attachment" is. – Chris Salzberg May 7 '16 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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