Thursday 15 September 2011

javascript - Get selected message data in Thunderbird extension -


I have to get some e-mail message data in my Thunderbird extension. I found this example on MDN ():

  var content = ""; Var MessageURI = GetFirstSelectedMessage (); Var MsgService = messenger.messageServiceFromURI (MessageURI); Var MsgStream = Components.classes ["@ mozilla.org/network/sync-stream-listener;1"] CreateInstance (); Var Consumer = MsgStream.QueryInterface (Components.interfaces.nsIInputStream); Var ScriptInput = Components.classes ["@ mozilla.org/scriptableinputstream;1"]. CreateInstance (); Var ScriptInputStream = ScriptInput.QueryInterface (Components.interfaces.nsIScriptableInputStream); ScriptInputStream.init (consumer); Try {MsgService.streamMessage (MessageURI, MsgStream, msgWindow, null, false, null); } Grip (Pre) {Warning ("Error:" + East)} ScriptInputStream. available (); While (ScriptInputStream .available ()) {content = content + ScriptInputStream .read (512); } Warning (content); However, when I run it, I receive the following error:  
  Timestamp: 2013.06.21 14:47:21 Error: ReferenceAir: GetFirstSelectedMessage defined No source file: Chrome: //edus_extension/content/messengerOverlay.js Line: 90   

What is this 'GetFirstSelectedMessage' function and how can I get message URI without using it ?

This document is outdated, I suggest:

  • By using gFolderDisplay.selectedMessage (try typing top.opener.gFolderDisplay.selectedMessage in the error console),
  • Services < To read some recent codes that use / code> and mailservices so that your code is simple

    It is being said, I do not know what you are trying to achieve, but:

    • You definitely like a cover It would be better to use MsgHdrToMimeMessage (self-reference :).
    • If you need to get the raw materials of the message completely, then this is an example of how to do it (it has been said that the implementation of MSHTHMMM message; by simplifying it, You must be able to get directly the raw figure of the message).

      Good luck with it, once you get a sample of work, please add it to the MDN Wiki!

      Cheers,

      Jonathan

No comments:

Post a Comment