Thunderbird 24.2.0 has a -mail
command-line parameter, with which a specific mail can be opened from the command line:
$ thunderbird --help
-mail <URL> Open the message specified by this URL.
I know that one can use this function to open a specific email by an imap://
URI, but I would like to be able to open a specific mail by its unique Message-ID, no matter which folder contains it. Is this possible, and if so, what does the URI look like?
The thunderlink add-on ( https://addons.mozilla.org/en-us/thunderbird/addon/thunderlink/ ) can create message-id based links to emails and then open these with the -thunderlink
parameter, but I would still like to know if this can be done with just the -mail
parameter.
Best Answer
Update 2021-03-18: The bug mentioned below has been fixed with Thunderbird version 78.8.1. No adjustments are necessary to open mails from the command line using thunderbird.exe -mail <URL>.
Opening messages with the
-mail
command line parameter is still possible with a current Thunderbird version (tested on Windows 10 with version 78.6.0, 32-bit).However, this requires a small change of the module
MailNewsCommandLineHandler.jsm
, because otherwise a getter-only error occurs when calling the -mail command. The error can be traced via the Thunderbird error console (see below).Adjusting the module:Copy the file
c:\Program Files (x86)\Mozilla Thunderbird\omni.ja
into a temporary directory, rename the file toomni.zip
and unpack it.Open MailNewsCommandLineHandler.jsm, insert
after line 22 and save the file.
Repack all files using the following parameters:
zip.exe -0DXqr omni.ja *
. Rename the original file toomni.ja.bak
and copy the repacked file toc:\Program Files (x86)\Mozilla Thunderbird
.Messages can then be opened using the following command lines:
Finding the right URL:
Error console: Open TB, select a message and open the error console (Ctrl + Shift + J). Enter the line
and press enter. This will open a window with the URL for the selected message.
SQLite database: If you plan to build your own search tool (e.g. by writing a Python plugin for the Wox desktop launcher), it is perhaps best to create the URLs dynamically.
The Thunderbird database can be found under
%APPDATA%\Thunderbird\Profiles\<profile>\global-messages-db.sqlite
. The tables messagesText_content, messages and folderLocations contain all information needed to assemble the URL strings.