On macOS, links of the form message://message-id are by default supported by the system.

Using a tool such as org-mac-link, it is straight-forward to link directly to relevant emails from Orgmode tasks and notes.

It does not matter if you have moved the mail around. When you open the link from Orgmode, the relevant email is instantly shown in Mac mail.

Fortunately, similar functionality can be configured on Windows and Linux using the Thunderbird mail client, an add-on called ThunderLink, and a touch of Emacs Lisp.

This post will show you exactly how.

I should mention at this point that you could opt to use thunderlink:// format links directly. However, my Orgmode files are filled with the slightly more standard message:// links from my recently ended (paused?) macOS phase, and I would prefer to continue using this MUA-agnostic convention just in case I end up switching operating systems and/or mail clients again in the future.

Install and configure the ThunderLink add-on

It hopefully goes without saying that for this solution you need to have Thunderbird setup to access your email account. I am currently using version 60.6.1.

Install the ThunderLink add-on.

In Thunderbird, go to Tools | Add-on Options | ThunderLink and then configure the add-on as follows (textual explanation follows the screenshot):

Show ThunderLinked emails in the context of their folders.

By default, ThunderLinked emails will be opened in their own windows, without any sort of thread context.

Change the “when running, open TLs” to “by selecting in mailbox” to show the opened email selected in the main mail list UI, which is in my opinion much more useful.

Add an extra copy format for Emacs Orgmode.

Under the first open tab (in my case this was String 7), add the following link format:

1
[[message://<messageid>][<subject>]]

… and title it “Emacs Orgmode Link” or something else memorable.

Configure Orgmode to invoke Thunderbird on message: links.

Add the following Lisp to your init.el after configuring the correct path to the thunderbird binary as the value of thunderbird-program.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
;; with org-mac-link message:// links are handed over to the macOS system,
;; which has built-in handling. On Windows and Linux, we can use thunderlink!
(when (not (string-equal system-type "darwin"))
  ;; modify this for your system
  (setq thunderbird-program "C:/Program Files/Mozilla Thunderbird/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)))
      (start-process
       (concat "thunderlink: " message-id)
       nil
       thunderbird-program
       "-thunderlink"
       (concat "thunderlink://messageid=" message-id)
       )))
  ;; on message://aoeu link, this will call handler with //aoeu
  (org-link-set-parameters "message" :follow #'org-message-thunderlink-open))

Link those emails!

This is as simple as right-clicking on the relevant email in Thunderbird, and then selecting ThunderLink | Emacs Orgmode Link from the context menu.

You can now paste the fully formed Orgmode message:// link into any Orgmode file.

If you open this link with C-c C-o or M-x org-open-at-point, your Thunderbird should appear in short order with the relevant email open, ready for you to take care of the associated task.

May all of your links LLAP.

By sticking to the message:// convention, and using org-link-set-parameters as demonstrated above to link to the mail reader of your choice at that moment, your Orgmode email links should easily survive all of your future operating system and mail user agent changes.