description: >- Descriptions and examples of MailExtension APIs to interact with Thunderbird’s

user interface.

Supported UI Elements

Browser Action

A browser action adds a button to Thunderbird’s main toolbar:

Supported UI Elements - 图1.png>)

It is controlled by the browser_action manifest key in the extension’s manifest.json file:

  1. "browser_action": {
  2. "default_title": "Restart",
  3. "default_icon" : "restart.png",
  4. "default_popup": "browser_popup.html"
  5. },

If a default_popup is defined, a popup will be opened and the defined html page will be loaded, when the button is clicked. Additionally, you can use the browserAction API in your background script to interact with the button to modify badge text, icon, title or its enabled state.

If the action button is defined as a menu typed action button, it will open a drop-down menu when clicked.

Note: The browserAction API has been renamed to action in Manifest V3.

Compose Action

A compose action adds a button to the toolbar of the composer window:

Supported UI Elements - 图2

It is controlled by compose_action manifest key in the extension’s manifest.json file:

  1. "compose_action": {
  2. "default_title": "Expand lists",
  3. "default_icon" : "lists.png",
  4. "default_popup": "compose_popup.html"
  5. },

If a default_popup is defined, a popup will be opened and the defined html page will be loaded, when the button is clicked. Additionally, you can use the composeAction API in your background script to interact with the button to modify badge text, icon, title or its enabled state.

If the action button is defined as a menu typed action button, it will open a drop-down menu when clicked.

Message Display Action

A message display action adds a button to the toolbar of the message view window:

Supported UI Elements - 图3

It is controlled by the message_display_action manifest key in the extension’s manifest.json file:

  1. "message_display_action": {
  2. "default_title": "Copy Patch",
  3. "default_icon" : "patch.png",
  4. "default_popup": "message_popup.html"
  5. },

If a default_popup is defined, a popup will be opened and the defined html page will be loaded, when the button is clicked. Additionally, you can use the messageDisplayAction API in your background script to interact with the button to modify badge text, icon, title or its enabled state.

If the action button is defined as a menu typed action button, it will open a drop-down menu when clicked.

CloudFile Provider Configuration

Thunderbird supports cloud providers to upload large attachments to a server, instead of attaching them directly to the email. Extensions can register such cloud providers using the CloudFile API. These providers can be managed in Thunderbird’s Composition options:

Supported UI Elements - 图4

Menu Items

The menus API allows modifying Thunderbird’s menus by adding or overriding menu items. The menu items can be added to different menus based on the provided context type. Examples can be found in our example repository.

Thunderbird menus are accessible through the following context types:

ContextDescription
allAdd menu entries to all supported contexts, excluding tab and tools_menu.
all_message_attachmentsAdd entries to the context menu of the summary area of message attachments.

Supported UI Elements - 图5

If the message has only one attachment, then the message_attachments context is used instead.
action,
browser_action, compose_action , message_display_action

Note: browser_action is available in Manifest V2 and action is available in
Manifest V3.
Add entries to the context menu of action buttons.

Supported UI Elements - 图6
action_menu,
browser_action_menu, compose_action_menu, message_display_action_menu,

Note: browser_action_menu is available in Manifest V2 and action_menu is available in Manifest V3.

Add entries to the drop-down menu of menu typed action buttons.

Supported UI Elements - 图7

compose_attachmentsAdd entries to the context menu of attachments in the compose window.

Supported UI Elements - 图8
editable,
password

Add entries to the context menu of text/password input fields in WebExtension windows, web tabs or message display tabs.

Limited to content areas.

Supported UI Elements - 图9

folder_paneAdd entries to the context menu of the folder pane of mail tabs.

Supported UI Elements - 图10
image,
audio,
video
Add entries to the context menu of embedded images, audio or video players in WebExtension windows, web tabs or message display tabs.

Limited to content areas.

Supported UI Elements - 图11
link

Add entries to the context menu of links in WebExtension windows, in web tabs or in message display tabs.


Limited to content areas.

Supported UI Elements - 图12

message_attachmentsAdd entries to the context menu of attachments of messages.

Supported UI Elements - 图13
message_listAdd entries to the context menu of the message list area of a mail tab.

Supported UI Elements - 图14
page,
frame

Add entries to the context menu of WebExtension windows, web tabs or message display tabs, if none of the other content contexts apply (link, selection, image, audio, video, editable, password).


If the page is loaded inside a frame, the frame context applies, otherwise the page context.

Limited to content areas.

Supported UI Elements - 图15

selection

Add entries to the context menu in WebExtension windows, web tabs or message display tabs, if any text has been selected.

Limited to content areas.

Supported UI Elements - 图16

tab

Add entries to the context menu of tab ribbons.

Supported UI Elements - 图17

The tab context can also be used to override the context menu of content pages (action popups or content tabs).

Supported UI Elements - 图18

See the menu example for more details.

tools_menuAdd entries to Thunderbird’s tools menu.

Supported UI Elements - 图19