Include links back to email messages using Dispatch, Postbox and Todoist

I recently completed Tiago Forte’s course on GTD, called Get Stuff Done Like a Boss. While I consider myself a GTD veteran by now, I still enjoy reading about and listening to other’s perspective. This is how we evolve.

I found Tiago did a great job of visually demonstrating how a GTD practice would look, while still keeping it open enough to give students space for individual tweaks and adaptations. I like that he stresses that that the system should work for you and not be a burden.

Personally, I got a nudge to finally fix a glitch I had in my own workflow: linking back to individual email messages when entering them into your task manager.

I don’t use gmail, and have 3 main active email accounts. I use Todoist to handle my tasks, and emails are handled with Postbox on my computer and Dispatch on my iPad. Now I got them to work with each other without problem.

For the TL:DR; – this is needed for the setup:

  • The Dispatch URL helper
  • An application script to convert a message:// url to open in Postbox
  • RCDefault App preference pane
  • A script to create x-dispatch:// URLs from Postbox to enter in Todoist

The workflow becomes:

On iOS

  • use Dispatch’s built-in Share to Todoist whenever an email needs an action

On macOS

  • run the script to copy the URL of the selected message in Postbox
  • open the Todoist Quick Add box and paste the link from clipboard

Now everything is linked together so that email message links in Todoist will open in your email client, no matter which platform you are on. I’ll describe the setup and give you the code for the scripts in this post.

Why jumping through all these hoops?

I had more or less given up on this. I had tried several other mail applications that works with both iOS and macOS but the newcomers on the block – Newton, Airmail, Spark and the like – all share the same flaw. No support for encryption.

I know, it’s not a trivial feature to add and not a very common request, so I don’t blame the developers for dodging this one. But it’s very important for those it matters to. And Postbox has enough features over the built-in Apple Mail that I’d like to keep using it.

Now Postbox’s x-postbox-message:// url-scheme doesn’t work on iOS, and I have no way of creating Postbox message URLs if I process emails on the iPad.

I had settled for flagging messages that had corresponding todo’s in Todoist and relied on email subject lines to find the right message. Not ideal, but it worked ok. I did it for almost a full year without system breakdown.

But doing Tiagos course reminded me of this non-ideal situation. And luckily this aligned with having a time slot where I could sit down and solve this once and for all. And the Dispatch URL helper was my missing piece to this puzzle.

Goal 1 – Get x-dispatch:// URLs to open the right message on desktop

You can configure Dispatch to always include a link back to the message when you’re processing emails and sending them to Todoist. Now we need a way to make these links work on the desktop too.

Install the Dispatch helper

Download and install the Dispatch URL helper. This is a one time thing. The helper will automatically convert the x-dispatch:// links into message:// links intended to open messages in Apple Mail. This all happens in the background and you will never need to worry about it again.

Create a script to open message:// URLs in Postbox

This is an applescript to handle opening email URLs in Postbox. I did not create this, I found it in this gist by Scott Reeves. He also provided the next step with RCDefault App.

on open location messageUri
    (* Extract message ID from the message:// URI. Where [MESSAGEID] is the message ID, the Dispatch OS X URL Helper sets up URLs for in the following format: message://%3c[MESSAGEID]%3e *)
 set messageId to text 14 thru -4 of messageUri
 do shell script "open x-postbox-message://" & messageId
end open location`

Save this script in Apple’s Script Editor. It is important to save the script as an application. Otherwise you can’t use it as a message handler, which is what we want. Put it where it’s easily accessible, like ~/Applications.

Apple Save dialog selecting "Save as application" option

Make sure our scripted application is the default handler for message:// URLs

The preference pane RCDefault App thankfully still works, even though it is several years old. Or at least, it still worked for me on macOS Sierra 10.12.6. With this, you can control which app will be default for opening file types – including url schemes which is what we’re after here.

Download RCDefault App and install it. After agreeing to install a non-developer-signed app, you will find the preference pane in System Preferences.

Go to the urls tab, scroll down to the message url, choose “Other…” and navigate to our newly created script application. Our script will now be the default handler for message:// urls.

RCDefault App Preference pane selecting our script as handler for message:// urls


Goal 2 – Always enter dispatch:// urls in Todoist from the desktop

This script I had to write myself. Thankfully the id’s of the messages match between Dispatch and Postbox. It’s only the wrapping of the id’s that differ. This is how the urls differ:

x-postbox://[MESSAGE ID]
x-dispatch://[MESSAGE ID]%3e

Since the dispatch urls need to have the email adress of the account in the url, I displayed a simple dialog to capture that. Unfortunately, neither the receiver’s email nor the corresponding Postbox account is accessible via applescript, so this was the workaround. 🙁

tell application "Postbox"
 set emailMessage to item 1 of (get selection)
  set messageURL to URL of emailMessage
  set messageSubject to subject of emailMessage
   -- build the dispatch link
 set messageId to text 21 thru -1 of messageURL
 set theResponse to display dialog "From which email account?" default answer "" with icon note buttons {"Continue"} default button "Continue"
 set mailAccount to text returned of theResponse
    set dispatchURL to "x-dispatch://" & mailAccount & "/%3e" & messageId & "%3e"
   -- build text for the clipboard
    set messageLinkText to messageSubject & " ([Open email in Dispatch](" & dispatchURL & "))"
 set the clipboard to messageLinkText
end tell

Save this in ~/Library/Scripts/Application/Postbox and it will be accessible in your Scripts menu whenever you’re in Postbox. Create the folder if it doesn’t already exist.

BONUS – make the script even easier to access

For those using Keyboard Maestro, go ahead and assign a shortcut for this script. Same thing for Alfred users. Since I use Launchbar, I went ahead and trained it on this script so it’s easily accessible.

Now when I want to add an action to Todoist is easy:

  • cmd + space to invoke Launchbar
  • type url to select my script
  • press enter
  • press enter directly or type the email if you want to change it from the default
  • type ctrl + alt + space to invoke Todoist Quick Add
  • type cmd + v to paste the link from the clipboard

I’m finally satisfied with my email processing

Now I finally have the magical link back to each email referenced in my task manager. Aaah!

Thank you to Scott Reeves who solved the opening-dispatch-links-in-postbox problem already in 2014(!) and to Kevin Holmen, instructor on the Forte Labs team who nudged me to take ownership of my inbox once and for all.

I was surprised over how satisfied I was over this small adjustment. I had gotten so used to the other way of working that I had ignored the friction. This shows how beneficial it can be to go back and review and tweak systems for greater efficiency.

Removing friction and automating things is what computers do best. Now it’s just time to retrain my habit to include the email links in Todoist too!

Scroll to Top