Search code examples
javascriptxulthunderbirdthunderbird-addon

Opening and printing a Thunderbird HTML file


I have a plugin for thunderbird that opens a mail file in the following way:

var uri = io.newFileURI(filePath);  
uri.QueryInterface(Components.interfaces.nsIURL);
uri.query = "type=application/x-message-display";
watcher.openWindow(null, "chrome://messenger/content/messageWindow.xul",
    "_blank", "all,chrome,dialog=no,status,toolbar", uri);

This works fine.

There is only one problem with HTML mails. They open just fine, but when they get printed, the message source is printed. Also the attachments source is printed.

Is there a way to specify that it is an HTML file that is being opened/printed? Any other suggestion?


Solution

  • I found the solution.

    The URI created was:

    file:///PATHTOFILE/file.eml ?type=application/x-message-display

    The space at the end of the filepath was the problem.

    So file:///PATHTOFILE/file.eml?type=application/x-message-display works perfectly