attachment not displayed in main body

User Help for Mozilla Thunderbird
Post Reply
User avatar
oliversm
Posts: 6
Joined: November 13th, 2019, 5:28 pm

attachment not displayed in main body

Post by oliversm »

I am trying to view a file attachment inline with the email. The file is a .inl file, which is easily viewable with any text editor (no different from a .c/cpp, .h/hpp, .txt file, etc.). However, for the life of me I can't get it to show (I noticed this when trying to print the email and saw this was not printed).

What I have tried so far:
  • Using the Show all body parts add o.
  • Clicking on the file, opening it with gedit, and setting this to be the default action.
  • Selecting View/Display inline attachments.
  • Selecting View/Headers/Show all add on
  • Updating from Thunderbird 52.7 to 68.2.2
Going on thunderbird settings/preferences and the attachments tab there is no file type registered for .inl and after some googling I am struggling to see how to add one. (One suggested the MIME but this is not available for the latest thunderbird).

I would like this (and possibly other textual attachments) to be displayed inline or included when printed.

A related question but without a workable solution is http://forums.mozillazine.org/viewtopic ... &t=1966097 (Display attachments inline), but this is old and likely outdated.
User avatar
tanstaafl
Moderator
Posts: 49647
Joined: July 30th, 2003, 5:06 pm

Re: attachment not displayed in main body

Post by tanstaafl »

View -> display attachments inline is dangerous as that means any attachment gets automatically opened when you open a message.

Does this problem occur with both view -> message body as original html and view -> message body as -> plain text?

If you use view -> message source or Control-U to look at the raw message source what is the Content-Type: header set to for the message as a whole (this should be near the Date: header) , and what are the headers for the inline attachment?
User avatar
oliversm
Posts: 6
Joined: November 13th, 2019, 5:28 pm

Re: attachment not displayed in main body

Post by oliversm »

I am aware that Display attachments inline is a security vulnerability. Usually I don't want this, but for a sub folder of selected emails, whose attachments I trust, I want this behaviour.

The problem occurs with all of the message view options (original html, simple html, plain text, all body parts).

I have the following content types:
  • Content-Type: multipart/mixed;
  • Content-Type: multipart/alternative;
  • Content-Type: text/plain; charset="iso-8859-1"
  • ...
Notably, for an attachment which can be displayed inline (a .cpp file) I have:
  • Content-Type: text/x-c++src; name=....
However, for the attachment that can't be displayed (an .inl file) I have:
  • Content-Type: application/octet-stream; name="bar.inl".
User avatar
tanstaafl
Moderator
Posts: 49647
Joined: July 30th, 2003, 5:06 pm

Re: attachment not displayed in main body

Post by tanstaafl »

The problem is that Content-Type: application/octet-stream; says its a binary file. You can't display the contents of a binary file inline. Even for a true attachment (not inline) its a problem because its not going to be associated with a helper program that can display a plain text file.

It should have been something like Content-Type: text/plain; . One workaround would have been for Thunderbird to fallback to guessing the file type from the file extension but the developers rejected that approach.

If you sent the file to yourself I suggest you look at the original file's properties using a file manager and see what type of file it claims it is. Or if you are using Linux (as your user agent string suggests) use $ file --mime-type filename.ini in a terminal/console window and see if it returns text/plain. You might be able to change the MIME type by right clicking on the file using your file manager, selecting properties, click on "open with" and then select a text editor.

https://stackoverflow.com/questions/160 ... a-ini-file
User avatar
oliversm
Posts: 6
Joined: November 13th, 2019, 5:28 pm

Re: attachment not displayed in main body

Post by oliversm »

I understand that a program would struggle to inline a binary, (Chrome, gedit, vim, etc, would also just spit out nonsense if trying to do such a thing). However, suppose I knew a program which could make sense of such a binary, (e.g. gedit?), can I not tell Thunderbird to try and use this program to make sense of a file type for inlining? I know this can be done for opening a file, so why not inlining?

When I first tried to open such a file I opted for gedit. I can see why the designers think guessing file types is not an ideal solution.

I have saved the file (from the email) to the desktop and ran the following:

Code: Select all

user:Desktop$ file --mime-type foo.inl 
foo.inl: text/x-c
which shows to me at least that my system recognises that this is a text like file (and it thinks it's C code, which is very close given it's C++). Can I not get thunderbird to make the same conclusion for a given file type?
User avatar
oliversm
Posts: 6
Joined: November 13th, 2019, 5:28 pm

Re: attachment not displayed in main body

Post by oliversm »

Even stranger update, is that another person sent me a similar/identical file which is displaying. If I download this file it still says:

Code: Select all

user:Desktop$ file --mime-type bar.inl 
bar.inl: text/x-c
My suspicion is that files were created on different a OS (I am using Ubuntu).

This is now driving me even more mad as I have no idea what is going wrong now.
User avatar
oliversm
Posts: 6
Joined: November 13th, 2019, 5:28 pm

Re: attachment not displayed in main body

Post by oliversm »

Edit, I just realised that the files foo.inl and bar.inl were created on one machine, zipped up, and that they were extracted by two different individuals (I expect on different OS's). Perhaps it is their mail clients or OS's or editors which are upsetting things. However, that shouldn't really affect how my thunderbird handles these file extensions.
User avatar
tanstaafl
Moderator
Posts: 49647
Joined: July 30th, 2003, 5:06 pm

Re: attachment not displayed in main body

Post by tanstaafl »

oliversm wrote:which shows to me at least that my system recognises that this is a text like file (and it thinks it's C code, which is very close given it's C++). Can I not get thunderbird to make the same conclusion for a given file type?
I'm not aware of a way to do that. There used to be a deprecated way to configure Thunderbird to use file extensions to determine the MIME type but that stopped working many years ago.

This problem is not unique to Thunderbird. My impression is that it effects many email clients.

https://bugzilla.mozilla.org/show_bug.cgi?id=1304908 has a telling comment by a developer: "Yes, well, you could argue that Thunderbird should treat "binary blurb" attachments better. It will go onto the huge pile of enhancement requests that we don't have time for. In the meantime I suggest to set preference mailnews.display.show_all_body_parts_menu and look at all the body parts via View > Message Body As > All Body Parts." https://bugzilla.mozilla.org/show_bug.cgi?id=517796 is an example of one of those enhancements requests.

I did find a ancient (v3.0 timeframe) bug report - https://bugzilla.mozilla.org/show_bug.cgi?id=444759 - "Thunderbird does not display pictures with APPLICATION_OCTET_STREAM content-type" that was supposedly fixed.

http://kb.mozillazine.org/Actions_for_a ... file_types mentioned a mime edit add-on, but the author removed it from the add-ons store. I found https://github.com/dafizilla/firefox-viewsourcewith which claims:

Thunderbird users can
* view the original messages received
* process messages to extract special infos from headers
* view attachments using different applications from default

but it was last updated 5 years ago so I doubt it will work with version 60 or 68.
sfhowes
Posts: 754
Joined: April 1st, 2012, 10:21 am

Re: attachment not displayed in main body

Post by sfhowes »

Text attachments aren't displayed inline anymore unless you change the preference mail.inline_attachments.text to true:

https://www.thunderbird.net/en-US/thund ... easenotes/

Tested with profiles.ini attached to a message. With the default pref. (false), the ini file isn't displayed inline. Setting the pref. to true makes the ini displayed inline.
Last edited by sfhowes on November 15th, 2019, 1:00 pm, edited 1 time in total.
User avatar
oliversm
Posts: 6
Joined: November 13th, 2019, 5:28 pm

Re: attachment not displayed in main body

Post by oliversm »

So it doesn't look like there is any scope to add this to thunderbird? Shame.
Post Reply