If you're familiar with developing browser extensions for Firefox, you're going to love this—because building extensions for Mozilla Thunderbird is quite similar!
Thunderbird is a powerful, open-source email client, and thanks to its support for Mail Extensions, you can create custom add-ons that extend its functionality, automate workflows, or even integrate third-party services.
In this tutorial, we’ll walk you through creating your very first Hello World Thunderbird Extension. Let’s dive in!
Before we begin, make sure you have the following:
Latest Thunderbird ESR version is installed
Basic understanding of JavaScript, HTML, and CSS required
Familiarity with WebExtension APIs (same as Firefox)
my-extension/
├── manifest.json
├── background.js
├── content-script.js
├── options.html
└── icons/
└── icon.png
Need an icon for you Thunderbird Extension? Visit our Thunderbird Extension Icon Generator and create your icons effortlessly.
{
"manifest_version": 2,
"name": "My Thunderbird Extension",
"version": "1.0",
"applications": {
"gecko": {
"id": "my-addon@example.com",
"strict_min_version": "91.0"
}
},
"background": {
"scripts": ["background.js"]
},
"permissions": ["messagesRead", "accountsRead", "compose"],
"browser_action": {
"default_popup": "options.html",
"default_icon": "icons/icon.png"
}
}
Permissions like messagesRead, accountsRead, and compose are specific to Thunderbird and are essential for interacting with email data.
Editbrowser.messages.listFolders().then((accounts) => {
accounts.forEach(account => {
console.log("Account:", account.name);
});
});
This confirms your extension is able to access email folders—your first successful interaction with Thunderbird APIs!
Open Thunderbird
Go to Tools > Add-ons and Themes > Extensions
Click the ⚙️ gear icon > Debug Add-ons
Click "Load Temporary Add-on" and select your manifest.json
This will load your extension temporarily. Use the built-in debugger to inspect logs, background scripts, and UI.
browser.messages. – Read, search, and manage email messages
browser.accounts. – Work with mail accounts and folders
browser.compose. – Automate message composition and sending
browser.tabs. – Control and manage Thunderbird tabs
bashCopyEditzip -r my-extension.xpi
This will create a .xpi file that can be distributed or installed.
That’s it! You’ve just created your first Hello World extension for Thunderbird. From here, you can build more advanced features like:
Auto-sorting emails
Adding custom UI panels
Integrating third-party APIs
Email scheduling and templating
Thunderbird’s MailExtension API unlocks a lot of potential for customization and productivity. Explore more on our Thunderbird Extension Development page, about what more you can build with expert help. Happy coding!