Url of an existing e-mail: get it and open it

In Thunderbird, I use ThunderLink allowing to create url to an existing e-mail and later on open such e-mail by opening given url.

Recently I reached Zero Inbox, easily emptying my inbox on all my accounts.

My Zero Inbox approach does not store mails in dedicated folder (as this does not allow me to state the action required on the e-mail), instead it files a task in my task management system.

Instead of using inbox as (rather poor) bucket of reminders I create link to an e-mail to process and use that url in task, which I create in my task manager (I am using e-macs with org-mode, but the same shall apply to any other task managers).

Having the task in my (trusted) system, I can safely archive the e-mail from my inbox.

At the time I come to resolving the task, I open my task, from here I open the e-mail and proceed.

Use case: Create url to an e-mail

Open some inbox, alternatively open the mail. This defines context “this e-mail”.

Then do something (like Ctrl-T, or using another shortcut) and it creates url pointing to given e-mail and puts that in clipboard.

Optional: ThunderLink also allows defining up to 8 different templates using url, datetime, subject, sender to create resulting text. This allows nice texts formatted almost as some types of tasks. Anyway, this is not rally necessary.

Use case: Open URL from external application

Having some sort of task manager, one shall be able to open the url in MailSpring.

The e-mail shall be open within MailSpring, new window is not required, it is acceptable to open it in existing MailSpring window, replacing previous view.

As one e-mail (having the same id) can live in multiple folders, the question is, where to open it. Putting folder into url is not the way to go, as it is very likely to change. Opening the e-mail anywhere is fine, in Gmail it could be in “All” folder.

(Originally posted by vlcinsky on GitHub.)

Hey! This seems like a great email workflow, and there’s actually a /bit/ of a way to do this in Mailspring currently!

If you build a URL that uses the mailspring:// URL scheme and encodes the subject of a message and the date it was received as a unix timestamp, you can link to a particular thread. (Or rather, you can link to the first search result). For example:


I think that right now it’d be difficult to incorporate this into a workflow because there’s not a great way of getting the value you need for “lastDate”. I’ll see if we can add a right click option or a menu option to get the URL from the email!

I’ve added a new menu item that is bound to Ctrl+L (Ctrl+T was taken on Windows with the Outlook keybindings unfortunately). You can also right click threads in the thread list now to access it as well. Enjoy!

(Originally posted by bengotow on GitHub.)

Nice, I have found it in my current Mailspring version. Very good.

My tests with opening that url seems to be working also very well:

Open from Firefox

pasting the url into address bar: it recognizes it and offers Mailspring as protocol handler and opens it (after my confirmation).

From console

From console (command line) I tried to enter $ mailsrping {url}. It complains a bit but opens the e-mail.

$ mailspring "mailspring://thread?subject=Re%3A%20FW%3A%20Open%20linked%20data%20support%20(was%20RE%3A%20Json%20mapping%20alternatives)&date=1561364694"
Gtk-Message: Failed to load module "canberra-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module
 Exiting because another instance of the app is already running.

Open from emacs org-mode:

I had to add new link handler:

    (org-add-link-type "mailspring" 'org-mailspring-open)

    (defun org-mailspring-open (path)
      "Opens an email in mailspring with mailspring link."
      (start-process "ms_name" nil "mailspring" (concat "mailspring:" path)))

    (provide 'org-mailspring)

then pressing enter on give link brings me to that e-mail.

I like it. Now I will play with it for few days.

(Originally posted by vlcinsky on GitHub.)

Interesting. I’m using org-mode too. and it works also very well but it opens another instance of Mailspring (not the same one as my mailspring). No configuration at all. As if it was the first time I use mailspring.
So to resume:

  • Before using the emacs lis code for org-mode, I had a completely configured mailspring.
  • I write the code in my .spacemacs and when I click ona link it opens another , unconfigured Mailspring! thing is this Mailspring, I do’nt know how to run it without clicking on the link !!.
  • Starting Mailspring from the menu or the command line will run the first Mailspring not the one that the link open !!! the links are coming from the first mailspring of course !
    How is it possible? Two processes, two different processes.
    Is it because of the start-process ?

(Originally posted by otesuji on GitHub.)


I tried adding your emacs script to my config for making the mailspring links work in emacs. However it isn’t working for me. Can you perhaps help me understand how I can go about doing the same?

Thank you.