On Fri, Feb 02, 2018 at 02:30:16PM +1100, Cameron Simpson wrote: > On 02Feb2018 10:45, Yubin Ruan <ablacktsh...@gmail.com> wrote: > > Hi, > > > > I got three attachments in a mail, as shown in the attachment view: > > > > [multipart/alternative, 7bit, 97K] > > [text/plain, quoted, utf-8, 9.2K] > > [text/html, quoted, utf-8, 87K] > > That's really 2 attachments. The text/plain and text/html parts are > _enclosed by the multipart/alternative part, which exists to offer two or > more choices which are meant to be equivalent. > > > After using the editor to view the whole email, it seems to me that the > > [multipart/alternative] part is an alias for both the [text/plain] and > > [text/html] part, because from what I have seen, there is no actual content > > in > > the [multipart/alternative] part. > > Yes, it is just an enclosure. In fact it is likely that the message itself > is the multipart/alternative part, containing a text/plain and a text/html > within it. But you can nest multipart sections if you need to. > > [...] > > the problem is, even though there are three attachments, only one is shown. > > I > > already have a > > > > auto_view text/html > > > > set in my .muttrc, yet the [text/html] is not shown (I can view the > > [text/html] attachment in the attachment view, though ). AFAIK, mutt will > > try > > to display all attachments automatically as long as it can be autoviewed. Is > > there any configuration options I miss here? > > Ah, no. > > What you've got looks like this, structurally: > > multipart/alternative > text/plain > some plain text ... > text/htmnl > some HTML text ... > > The main text/ area is the "message" part. When mutt displays a message from > a multipart/alternative section it chooses _one_ of the alternatives offers, > and transcribes that to a plain text appearance using the rules from your > mailcap settings (which may just be the system defaults). > > A message with "attachments" comes with the type "multipart/mixed", > indicating that it contains a mixture of parts, almost always a "message" > part with the text and other parts being the zttachments, such as zip files. > A mail message with attachments usually looks like this, structurally: > > multipart/mixed > multipart/alternative > text/plain > some plain text ... > text/htmnl > some HTML text ... > image/jpeg > a JPEG image, suitably encoded > application/pdf > a PDF file > > and so forth. > > So what you have is a plain text message with no "attachments". The mutt > "attachement" menu shows you all the parts, but more conventional mail > readers withn't present the text area as an "attachment". > > Regarding your beleif that you're getting the text/plain presented, this may > well be so. Your setting: > > auto_view text/html > > is documented here: > > http://www.mutt.org/doc/manual/#auto-view > > It says that you know how to present text/html as plain text for viewing in > the "pager" mutt view. It will look up a mailcap entry for "text/plain" > which has the "copiousoutput" option. If you or your system doesn't have > such an entry the "auto_view" setting is probably ignored. So mutt may be > choosing the text/plain alternative because of this. > > There is a system mailcap file and you can also have a personal > $HOME/.mailcap file. Mine has this: > > text/html; exec 2>&1 && env DISPLAY= unhtml %s; copiousoutput > > and "unhtml" is a script of mine which currently calls "lynx -stdin -dump", > and used to run "w3m -dump -T text/html". So you could use: > > text/html; w3m -dump -T text/html; copiousoutput > > to tell mutt how to present HTML as plain text. > > Mutt needs such things because the pager presents plain text.
Thanks for your explanation about [multipart/alternative] and [multipart/mixed]. I check several mails and they all seems to work in the way you described. -- Yubin