Some years ago it was possible to use the Thunderlink plugin to obtain a “link” to a specific email, and when you clicked that link it would open Thunderbird with a focus on the required email. However, that project died. Fortunately, Camiel Bouchier made the necessary re-writing of the code need to make it work with newer versions of Thunderbird’s API, in what it’s called cb_thunderlink. For the time of writing ([2023-08-26 Sat]) it is still maintained, let’s hope it keeps that way.

The (sort of) documentation for the plugin is on this post of Camiel’s website. And to use it in conjunction with Emacs it is also needed an Elisp workaround to tell emacs how to respond when org-open-at-point is executed on one of cb_thunderlink’s link.

  1. The installation of the cb_thunderlink plugin is straightforward in the Thunderbird Plugin Store.
  2. The workaround, on the other hand, I got from vxlabs’ website, where he explains how to Link directly to emails from Emacs Orgmode using Thunderbird and Thunderlink. As you may have noticed, the workaround was written for thunderlink, not for cb_thunderlink, so I have made some modifications to it. Also, there was a conditional to check if the system was Mac or not, I removed that part too as I do not need it. See the code below:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
 (setq thunderbird-program "thunderbird")
 
 (defun org-message-thunderlink-open (slash-message-id)
   "Handler for org-link-set-parameters that converts a standard message:// link into
  a thunderlink and then invokes thunderbird."
   ;; remove any / at the start of slash-message-id to create real message-id
   (let ((message-id
          (replace-regexp-in-string (rx bos (* "/"))
                                    ""
                                    slash-message-id)))
     (kill-new (concat "cbthunderlink://" message-id))
     (start-process
      (concat "cbthunderlink: " message-id)
      nil
      thunderbird-program
      "-cbthunderlink"
      (concat "cbthunderlink://" message-id)
      )))
 ;; on message://aoeu link, this will call handler with //aoeu
 (org-link-set-parameters "message" :follow #'org-message-thunderlink-open)

A link generated with cb_thunderlink looks something like this:

1
cbthunderlink://MjAyMy0wOC0yNVQxNToyOTowMC4wMDBaO05h

In the article Link directly to emails from Emacs Orgmode using Thunderbird and Thunderlink they suggest to write in your notes message instead of cbthunderlink, this way you can use something else in the future in case cb_thunderlink also dies as the linking system in your notes will not depend on it (at least completely).

In the configuration of the cb_thunderlink plugin you can manage the format to copy the email link. In my case I have made one called emacsOrgLink, which is set to [[message://$cblink$][$subject$]] to comply with Org-mode link format. Note that the name of the link will be the subject of the email.

The code above will associate the function org-message-thunderlink-open to the message key when org-open-at-point is executed on these links, and then it will replace message with cbthunderlink to pass the link to Thunderbird. Of course this part can be avoided by just letting the links in their original format (starting with cbthunderlink), and the function would be really simple. Once more, I chose message over cbthunderlink because message is built in Emacs. Nevertheless, I do not think if I stop using Thunderbird and go to Mu4e or Gnus the links would work (because of their messageid being different in Mu4e-Gnus VS cb_thunderlink). Anyway see this recent post of vxlab which is similar to the one discussed above, but for Mu4e and fastmail. You can decide which format to use.

The last point to highlight is the use of (kill-new (concat "cbthunderlink://" message-id)). Because of limitations of the Thunderbird API, which dropped support for the thunderbird -thunderlink <email-link> clickable feature, cb_thunderlink cannot directly open the emial is some systems (see documentation). In those systems where it cannot simulate the needed behavior and open the specific email directly, instead, it creates a button on the top-right corner (close to the “Display Thunderbird menu”), which once clicked will use the content of the clipboard to open the corresponding email, in case the content of the clipboard is a cb_thunderlink email link. This line of code copy the email link to the clipboard so we can access the desired email.

Summarizing, once everything is set up. You right-click on the body of the email in Thunderbird, go to the cb_thunderlink menu entry (usually on the bottom), and copy the formatted link you established (emacsOrgLink in my case). Next, past it in Emacs. Once you need to use it, just execute org-open-at-point (C-c C-o), and it will open Thunderbird, but in some cases not yet the specific email. If this functionality is missing, to open the specific email just click on the cb_thunderlink button on the top-right region. You should see now the email.

This solution is not es elegant as the use of Gnus and Notmuch, but certainly will require much less setup than those two, and time, which I don’t have right now for that. If you have not the time, or would like to continue with the visual interface oriented approach that is Thunderbird in face to Gnus and Notmuch, this is the solution to have links in your notes redirecting to the related email.

⋇ ⋇ ⋇ ⋇ ⋇

Thanks for reading the post! Do not hesitate to write me an email, and share your point of view 😉: contact@poview.org