Building a Thunderbird extension

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:

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.

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.