Add Option to Context Menu

Assuming this on chrome.manifest:

overlay    chrome://messenger/content/mailWindowOverlay.xul     chrome://myext/content/thunderbird-overlay.xul

Add the next in thunderbird-overlay.xul.

For Thunderbird 2

 

  <?xml version="1.0"?>
  <overlay id="sample" 
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <menupopup id="messagePaneContext">       
      <menuitem 
        id="my_option"          
        label="My option concise and cool label"          
        oncommand="alert('Hi')"/>   
    </menupopup>
  </overlay>

For Thunderbird 3

  <?xml version="1.0"?>
  <overlay id="sample" 
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
      <popup id="mailContext">
       <menuitem 
        id="my_option" 
        label="My option concise and cool label" 
        oncommand="alert('Hi')"/>
    </popup>
</overlay>

For Thunderbird 2 and 3 in the same XPI

If our extension needs to support Thunderbird 2 and 3 we need to make custom overlays for each version. This can be reached by adding these lines to the chrome.manifest file:

overlay chrome://messenger/content/mailWindowOverlay.xul chrome://myaddon/content/tbOverlay-tb2.xul appversion<3.0
overlay chrome://messenger/content/mailWindowOverlay.xul chrome://myaddon/content/tbOverlay-tb3.xul appversion=>3.0

Than we need two overlay XUL files with content from examples above.

Note: If our extension supports more Mozilla applications (for example Mozilla Firefox and Mozilla Thunderbird) we need also specify application flag. For more details see Chrome Registration.