Windows – Thunderbird uses wrong attachment mime type on Windows Vista

attachmentsmime-typesthunderbirdwindows-vista

Thunderbird running on Windows Vista has usually sent Microsoft Word documents as mime type application/msword, which as I understand is correct. However, now it has suddenly decided to send Word documents as mime type text/richtext, which creates a big problem as a recipient client may interpret the message as displayable inline – which in fact just creates garbage on the screen as it cannot handle direct display of Word documents. At least Thunderbird itself as a recipient does this, but I'd imagine other clients might as well.

As far as I can understand, Thunderbird picks up the mime type of the attachment from the operating system, instead of determining it by itself. This would suggest that something might be wrong with how Vista assigns mime types. However, I coudn't find a way to adjust on Vista how mime types are determined – only file type setting seems to be about which program opens them. However, this seems to be in order, since in registry HKEY_CLASSES_ROOT\.doc does contain the correct mime type – and in fact, the string text/richtext is nowhere to be found in registry.

It's also worth mentioning that other file types do still get their correct mime type.

How do I force Thunderbird to use the correct application/msword mime type for Microsoft Word document attachments (when sending email)?

Or: How do I determine what mime types are assigned to different file types on Windows Vista?

Or: How do I troubleshoot this issue further? (For example by determining if the problem is with Vista providing the wrong mime type for Thunderbird, or with Thunderbird not accepting what vista provides?)

Here's a sample of the failed attachment header:

Content-Type: text/richtext; name="Foo Bar.doc"    
Content-Description: Foo Bar.doc    
Content-Disposition: attachment;    
 filename="Foo Bar.doc"; size=85056;    
 creation-date="Thu, 17 Sep 2009 11:14:20 GMT";    
 modification-date="Thu, 17 Sep 2009 11:14:20 GMT"    
Content-Transfer-Encoding: base64

The problem now has a solution. The immediate cause of the problem turned out to be mimeTypes.rdf. The problem was caused by (and can be duplicated by adding) the following section in the file:

<RDF:Seq RDF:about="urn:mimetypes:root">
  <RDF:li RDF:resource="urn:mimetype:text/richtext"/>
</RDF:Seq>
<RDF:Description RDF:about="urn:mimetype:text/richtext"
                 NC:value="text/richtext"
                 NC:editable="true"
                 NC:fileExtensions="doc"
                 NC:description="Microsoft Office Word 97 - 2003">
  <NC:handlerProp RDF:resource="urn:mimetype:handler:text/richtext"/>
</RDF:Description>

Best Answer

Interesting issue. Upfront it's worth noting that text/richtext is an e-mail related mime type obsoleted by text/enriched and entirely unrelated to application/rtf, see Wikipedia about Enriched text:

Enriched text is a formatted text format for e-mail, defined by the IETF in RFC 1896 and associated with the text/enriched MIME type.
[...]
A predecessor of this text/enriched MIME type was called text/richtext in RFC 1341 and RFC 1521. Neither should be confused with Rich Text Format (MIME type text/rtf or application/rtf) which is an entirely different specification, devised by Microsoft.

The only clue I could find is targeting Horde/IMP via Firefox, but seems to address the same problem, see Word attachment file problem:

You might have received some document which is in rich text format. You might have opened it using Microsoft word and this has resulted in adding a mime-type called 'text/richtext' with its supporting application as MS-word in your browser setting. Subsequently, when you attach any word document, the browser is identifying any attached word document as 'text/richtext' type instead of 'application/msword'.

Due to Firefox and Thunderbird sharing much code this might well apply to Thunderbird too.

How do I force Thunderbird to use the correct application/msword mime type for Microsoft Word document attachments (when sending email)?

Why this is happening has apparently not been finally resolved, however, the temporary solution offered by the poster should apply too, as Thunderbird is using mimeTypes.rdf also. However, before applying the drastic measure to simply delete this file from your Thunderbird user profile and restart Thunderbird (which will likely restore the default file), I'd try to investigate this further to avoid loosing deliberate changes to Download Actions:

  • First you should have a look into your Thunderbird settings:
    Under Tools->Options->Attachments->Download Actions you'll find the user configured mime type related actions per file extension as stored in mimeTypes.rdf (i.e. just those different from default settings I guess). In principle the changed setting regarding Word documents should manifest itself there (though given the circumstances it might as well be some implied specialty or even a bug).
  • In case this doesn't yield a result you could still peak into mimeTypes.rdf and try to figure out which particular setting is wrong, if any.

Whether avoiding the simple deletion of mimetypes.rdf like so is worth the trouble depends on your situation of course.

Related Question