On 20Jun2014 09:32, Martin Vegter <[email protected]> wrote:
Could anybody please help with the second part of my question, i.e. why
message body is displayed as if it were attachment?

To a degree I think that's just how it's done, but there are structural and presentation reasons for it.

A message _without_ an attachment has the content-type in the message header as either a "text/..." type (plain or html most commonly) or a "multipart/alternative". All of these are a single top level piece of content; the message. In the former case ("text/...") mutt just takes the content and formats it for display. In the latter case, mutt looks at the subparts of the "multipart/mixed" top level container and picks one and formats it for display. There are no markers because there is only one part to consider.

By contrast, a message with attachments is not so overtly a "message" part and an "attachment". Instead, the top level content type is "multipart/mixed", and the top level container has an arbitrary number of parts in no particular order.

_Conventionally_, the first part will have a content-type like the top level of a message with no attachements: a "text/..." or "multipart/alternative". This will be your message text. The following parts will typically have other content-types according the the attachment file type and have a "content-disposition" of "attachment".

However, there's no requirement for this order, or for there to be just one "text" component, or any.

Finally, mutt is entirely capable of presenting attachement files inline with the message text. By default it will just mark out the filename and so forth, but you can set arbitrary programs to transcribe a different description. For example, I have my own formatter for HTML (the standard recipe with some embellishments), I pipe PDFs through a program to extract their text and crudely format it, and image attachments get handed to a program to recite their data formats and pixel sizes.

So mutt just walks the list of parts in the multipart/alternative and transcribes them with leading markers so you know where each part starts and ends. These markers also apply to the leading message text.

Cheers,
Cameron Simpson <[email protected]> and Kath Knight <[email protected]>

Reply via email to