mozilla

Revision 501015 of Building a Thunderbird extension 1: introduction

  • Revision slug: Mozilla/Add-ons/Thunderbird/Building_a_Thunderbird_extension
  • Revision title: Building a Thunderbird extension 1: introduction
  • Revision id: 501015
  • Created:
  • Creator: wbamberg
  • Is current revision? Yes
  • Comment outdated noticeExtensions/Thunderbird/Building_a_Thunderbird_extension Mozilla/Add-ons/Thunderbird/Building_a_Thunderbird_extension

Revision Content

Thunderbird is Mozilla's open-source email application. It shares many of the technologies used by Firefox, including JavaScript, the Gecko layout engine, the XUL XML User Interface Language and the XPCOM Cross-Platform Component Object Model. Similar to Firefox, Thunderbird functionality can be enhanced and customized via extensions.

This tutorial will introduce you to the components of a Thunderbird extension and will show you how to build your own. The tutorial has the following pages:

  1. Introduction (this page)
  2. The extension filesystem (setting up your local system)
  3. Install manifest (the install.rdf file that contains meta-information about the extension)
  4. Chrome manifest (list of packages and overlays)
  5. XUL (the XML user interface language that is used to modify the Thunderbird user interface)
  6. Adding JavaScript (explains how to add some simple JavaScript to your Thunderbird extension)
  7. Installing locally (enabling the extension on your local Thunderbird instance)
  8. Packaging (making a distribution package that contains the extension)
  9. Distributing (from your own site or from http://addons.mozilla.org/)

This tutorial is compatible with Thunderbird versions 2,3 and 5. All Thunderbird builds are available from the ftp site.

References and resources

Tools and helper extensions

There are many tools available that help with developing Thunderbird extensions. At a minimum you will need:

  • Text editor: Any editor that is capable of writing plain text can be used to write extensions. However, most developers use an editing program optimized for writing code (also known as an Integrated Development Environment). These provide features like syntax highlighting and code coloration, indentation, auto-complete, etc.
  • File archive utility: Any utility that is capable of creating archive files can be used.

There are also a number of extension and applications that are useful for testing and debugging Thunderbird extensions, such as JavaScript consoles and XPCOM inspectors. These are described on the page "Setting up an extension development environment".

Add-on builder

To automatically generate a Firefox or Thunderbird extension framework, use the Add-on Builder available from the Add-on Developer hub (update: the add-on builder has chaged and this tutorial has not been updated since). The add-on builder is a web-based utility that creates a simple add-on file skeleton in zip file format. A simple wizard collects basic information about the add-on and the functionality you intend for it. The builder then creates the necessary folder structure, meta data and source files. The source files will be filled with some sample code that allows you to start hacking right away.

Much of what you will learn in this tutorial will be done automatically for you by the add-on builder. However, this tutorial explains the relationships between the different files and the structure of their content. After you have finished reading this tutorial, you will understand the general structure and layout of the files in an add-on. You can then use the add-on builder to create new add-ons faster then if you start from scratch.

Documentation

Community

 The Thunderbird development community has a mailing list with a searchable archive. You can also talk to the community on the #maildev IRC channel.

{{ Next("Extensions/Thunderbird/Building_a_Thunderbird_extension_2:_extension_filesystem") }}

Revision Source

<p>Thunderbird is Mozilla's open-source email application. It shares many of the technologies used by Firefox, including <a class="internal" href="/en/JavaScript" title="en/JavaScript">JavaScript</a>, the <a class="internal" href="/en/Gecko" title="en/Gecko">Gecko</a> layout engine, the <a class="internal" href="/en/XUL" title="en/XUL">XUL</a> XML User Interface Language and the <a class="internal" href="/en/XPCOM" title="en/XPCOM">XPCOM</a> Cross-Platform Component Object Model. Similar to Firefox, Thunderbird functionality can be enhanced and customized via <a class="external" href="http://addons.mozilla.org/en-US/thunderbird/" title="http://addons.mozilla.org/en-US/thunderbird/">extensions</a>.</p>
<p>This tutorial will introduce you to the components of a Thunderbird extension and will show you how to build your own. The tutorial has the following pages:</p>
<ol>
  <li>Introduction (this page)</li>
  <li><a class="internal" href="/en/Extensions/Thunderbird/Building_a_Thunderbird_extension_2:_extension_filesystem" title="en/Extensions/Thunderbird/Building a Thunderbird extension 2: extension filesystem">The extension filesystem</a> (setting up your local system)</li>
  <li><a class="internal" href="/en/Extensions/Thunderbird/Building_a_Thunderbird_extension_3:_install_manifest" title="en/Extensions/Thunderbird/Building a Thunderbird extension 3: install manifest">Install manifest</a> (the <code>install.rdf</code> file that contains meta-information about the extension)</li>
  <li><a class="internal" href="/en/Extensions/Thunderbird/Building_a_Thunderbird_extension_4:_chrome_manifest" title="en/Extensions/Thunderbird/Building a Thunderbird extension 4: chrome manifest">Chrome manifest</a> (list of packages and overlays)</li>
  <li><a class="internal" href="/en/Extensions/Thunderbird/Building_a_Thunderbird_extension_5:_XUL" title="en/Extensions/Thunderbird/Building a Thunderbird extension 5: XUL">XUL</a> (the XML user interface language that is used to modify the Thunderbird user interface)</li>
  <li><a href="/en/Extensions/Thunderbird/Building_a_Thunderbird_extension_6:_Adding_Javascript" title="en/Extensions/Thunderbird/Building a Thunderbird extension 6: Adding Javascript">Adding JavaScript</a> (explains how to add some simple JavaScript to your Thunderbird extension)</li>
  <li><a class="internal" href="/en/Extensions/Thunderbird/Building_a_Thunderbird_extension_7:_Installation" title="en/Extensions/Thunderbird/Building a Thunderbird extension 7: Installation">Installing locally</a> (enabling the extension on your local Thunderbird instance)</li>
  <li><a class="internal" href="/en/Extensions/Thunderbird/Building_a_Thunderbird_extension_8:_packaging" title="en/Extensions/Thunderbird/Building a Thunderbird extension 8: packaging">Packaging</a> (making a distribution package that contains the extension)</li>
  <li><a class="internal" href="/en/Extensions/Thunderbird/Building_a_Thunderbird_extension_9:_distributing" title="en/Extensions/Thunderbird/Building a Thunderbird extension 9: distributing">Distributing</a> (from your own site or from <a class="external" href="http://addons.mozilla.org/" rel="external nofollow" target="_blank" title="http://addons.mozilla.org/">http://addons.mozilla.org/</a>)</li>
</ol>
<p>This tutorial is compatible with Thunderbird versions 2,3 and 5. All Thunderbird builds are available from <a class="external" href="http://ftp.mozilla.org/pub/mozilla.org/thunderbird/" title="http://ftp.mozilla.org/pub/mozilla.org/thunderbird/">the ftp site</a>.</p>
<h2 id="References_and_resources">References and resources</h2>
<h3 id="Tools_and_helper_extensions">Tools and helper extensions</h3>
<p>There are many tools available that help with developing Thunderbird extensions. At a minimum you will need:</p>
<ul>
  <li><a class="external" href="http://en.wikipedia.org/wiki/List_of_text_editors" title="http://en.wikipedia.org/wiki/List_of_text_editors">Text editor</a>: Any editor that is capable of writing plain text can be used to write extensions. However, most developers use an editing program optimized for writing code (also known as an Integrated Development Environment). These provide features like syntax highlighting and code coloration, indentation, auto-complete, etc.</li>
  <li><a class="external" href="http://en.wikipedia.org/wiki/Comparison_of_file_archivers" title="http://en.wikipedia.org/wiki/Comparison_of_file_archivers">File archive utility</a>: Any utility that is capable of creating archive files can be used.</li>
</ul>
<p>There are also a number of extension and applications that are useful for testing and debugging Thunderbird extensions, such as JavaScript consoles and XPCOM inspectors. These are described on the page "<a class="internal" href="/en/Setting_up_extension_development_environment" title="en/Setting up extension development environment">Setting up an extension development environment</a>".</p>
<h4 id="Add-on_builder">Add-on builder</h4>
<p>To automatically generate a Firefox or Thunderbird extension framework, use the <a class="external" href="http://addons.mozilla.org/en-US/developers/tools/builder" title="http://addons.mozilla.org/en-US/developers/tools/builder">Add-on Builder</a> available from the <a class="external" href="http://addons.mozilla.org/en-US/developers" title="http://addons.mozilla.org/en-US/developers">Add-on Developer hub</a> (update: the add-on builder has chaged and this tutorial has not been updated since). The add-on builder is a web-based utility that creates a simple add-on file skeleton in zip file format. A simple wizard collects basic information about the add-on and the functionality you intend for it. The builder then creates the necessary folder structure, meta data and source files. The source files will be filled with some sample code that allows you to start hacking right away.</p>
<p>Much of what you will learn in this tutorial will be done automatically for you by the add-on builder. However, this tutorial explains the relationships between the different files and the structure of their content. After you have finished reading this tutorial, you will understand the general structure and layout of the files in an add-on. You can then use the add-on builder to create new add-ons faster then if you start from scratch.</p>
<h3 id="Documentation">Documentation</h3>
<ul>
  <li><a class="internal" href="/en/Extensions/Thunderbird" title="en/Extensions/Thunderbird">Thunderbird extensions (documentation overview)</a></li>
  <li><a class="internal" href="/En/Firefox_addons_developer_guide" title="En/Firefox addons developer guide">Firefox addons developer guide</a> (many topics are applicable to Thunderbird)</li>
  <li><a class="external" href="http://mxr.mozilla.org/comm-central/" title="http://mxr.mozilla.org/comm-central/">Mozilla cross-reference</a> source code browser ("comm-central" contains the Thunderbird code repository)</li>
</ul>
<h3 id="Community">Community</h3>
<p>&nbsp;The Thunderbird development community has a <a class="external" href="http://groups.google.com/group/mozilla.dev.apps.thunderbird/topics?lnk" title="http://groups.google.com/group/mozilla.dev.apps.thunderbird/topics?lnk">mailing list</a> with a searchable archive. You can also talk to the community on the <a class="link-irc" href="irc://moznet/#maildev" title="irc://moznet/#maildev">#maildev IRC channel</a>.</p>
<p>{{ Next("Extensions/Thunderbird/Building_a_Thunderbird_extension_2:_extension_filesystem") }}</p>
Revert to this revision