Adding new files & attachments in Thunderbird (2nd)
This is new question in relation to the original "Adding new files & attachments in Thunderbird" post. I can't create a new definition for .LOG files that will launch the .LOG attachment in NOTEPAD.
I copied the definition for 'text' in 'handlers.json' to create one (I thought) for .LOG files. It shows in Preferences and I can assign NOTEPAD to it there. Here's the update JSON. However, the only action that works is SAVE. I can't get NOTEPAD to launch
"text/plain":{ "action":4, "extensions":[ "txt" ] }, "log/plain":{ "action":2, "extensions":[ "log" ], "handlers":[ { "name":"NOTEPAD.EXE", "path":"C:\\WINDOWS\\system32\\NOTEPAD.EXE" } ] },
Valgt løsning
I tried an experiment.
I'm using the Windows Powershell script 'SendMail.ps1' to send the email. I was wondering if something there was setting the content-type to application/octet-stream so I changed the extension of the file I created from .LOG to .TXT. When I did this, TB properly opened Notepad with the new file.
However, when I checked the message, the content-type for the new .TXT file was the same as the .LOG.
So it seems that TB triggers on the extension rather than content-type.
Test Body -boundary_0_053697b5-9255-4690-8d55-0f0349b7cee4 Content-Type: application/octet-stream; name=MyPics___2022-01-21.txt Content-Transfer-Encoding: base64 Content-Disposition: attachment
Læs dette svar i sammenhæng 👍 0Alle svar (4)
Thunderbird and the internet in general use media types to launch helper applications. Only windows cares what the file is called or what it's extension is.
If your email is encoding the mail as log/text then your edit might work. But what is it being encoded as in the message source?
I have observed a very cavalier attitude from many windows .net developers who really have no idea about media types because they only know windows. They encode text files as all sorts of weird and wonderful things. Most commonly as binary data streams, "because it works"
BTW hand editing Thunderbird configuration files is often a recipe for disaster. There is a user interface for media types in the preferences. Please use it.
If your mail was encoded as you have set, it would have set that through the user interface. As I implied before, I think the encoding on the email is just plain wrong.
I would expect the log file as a text file to be encoded as Text/Plain.
Thanks Matt.
I should have mentioned that these emails are log files I sent to myself from overnight jobs. I've been doing this for years but suddenly they stopped being launched into notepad. So, what I gather is either there was something that changed in the mail encoding or how TB processed.
"BTW hand editing Thunderbird configuration files is often a recipe for disaster. There is a user interface for media types in the preferences. Please use it." I only edited the configuration because the answer to the original post described to do that. I wouldn't do that again.
You've explained the approach TB is using to match an attachment to an content type. When I examine the message, this is what I see for the attachment.
Test Body
boundary_0_347c87ce-d4d1-4909-8e19-e6125f853790
Content-Type: application/octet-stream; name=MyPics___2022-01-19.log Content-Transfer-Encoding: base64 Content-Disposition: attachment
So do I need a definition for 'application/octet-stream'?
octet streams are binary, they will not open. You need to modify the encoding in the log to show it is a text file. My guess is somewhere in the past you have used one of Paolo Kaomos addons that allowed you to open files by extension. But he has not updated any of his extensions since about Thunderbird 60. So none of them work now.
About all I can point you to is the registered media types and the specific notes on what applications are suggested to do with the type. https://www.iana.org/assignments/media-types/application/octet-stream
You "might get away with" another manual edit, I think Thunderbird will actively ignore anything in the UI because of the recommended action. In this instance it does represent a minor security risk, but I don't think notepad would provide a very good vector to exploit. (But I thought windows XP was great in it's day as well.)
Valgt løsning
I tried an experiment.
I'm using the Windows Powershell script 'SendMail.ps1' to send the email. I was wondering if something there was setting the content-type to application/octet-stream so I changed the extension of the file I created from .LOG to .TXT. When I did this, TB properly opened Notepad with the new file.
However, when I checked the message, the content-type for the new .TXT file was the same as the .LOG.
So it seems that TB triggers on the extension rather than content-type.
Test Body -boundary_0_053697b5-9255-4690-8d55-0f0349b7cee4 Content-Type: application/octet-stream; name=MyPics___2022-01-21.txt Content-Transfer-Encoding: base64 Content-Disposition: attachment