Script: Add URL from iPhone to DEVONthink 3's reading list

Hi there, I often wanted to add the current URL from iPhone’s Safari to DEVONthink 3’s reading list. That’s possible by using a bookmarklet and a macOS rule.

On iPhone the bookmarklet grabs the current site’s name and URL and fills a new mail with it, ready to send it to yourself.

On Mac the mail rule looks for a specific string (I use @r |) in the subject of the received mail and starts an AppleScript that adds the URL to DEVONthink 3’s reading list.

To add the bookmarklet to Safari

  • create a bookmark for an existing website in Safari’s favorites (e.g. (that’s necessary as it doesn’t seem to be possible to create empty bookmarks in Safari. By the way it’s easier to do this on Mac (if you sync Safari on macOS and iOS…)

  • in Safari open the menu which lets you edit bookmarks

  • change the URL of the created bookmark to javascript:location.href='mailto:YourEmailAddress?SUBJECT=@r%20%7C%20'+document.title+'&BODY='+escape(location.href) (the question mark after your mail address is part of the bookmarklet, don’t delete it)

  • change the name of the bookmark to something meaningful

To add the mail rule to Mail

  • create a new rule that looks for the specific string in the subject (e.g. @r |)

  • as action choose “Delete mail”

  • save this script and add it to mail’s script folder (found in the context menue of the AppleScript action). Attach it as second action to the rule

    using terms from application "Mail"
      on perform mail action with messages theMessages
      	tell application "Mail"
      		repeat with thisMessage in theMessages
      			set theSubject to subject of thisMessage
      			set theName to characters 6 thru -1 in theSubject as string -- change if you don't use "@r | " in the bookmarklet
      			set theBody to content of thisMessage
      			set theURL to paragraph 1 of theBody
      			tell application id "DNtp"
      					add reading list URL theURL title theName
      					display notification theName with title "Added to reading list"						
      			end tell
      		end repeat
      	end tell
      end perform mail action with messages
      end using terms from

In german it looks like this


Now when you want to add an URL from iPhone (or iPad, but I didn’t test this) to DEVONthink 3’s reading list it’s just 3 taps: one on Safari’s address bar to access the favorites, one on the bookmarklet, one on “send” in That’s it

I’m sorry, I just found out that only the latest sent mail will be added with this setup. Tried to make it work for all mails that match the rule but without luck. Any ideas?

Why are you creating an email and using a Mail Rule for this?

Why not just clip the URL to DEVONthink To Go and sync to DEVONthink 3? The add a simple smart rule, like this…

PS: Some people may notice the Cancel action in the smart rule. There is no ill effect from this (unless @cgrunenberg has something to say on it), but it allows you to do a little debugging of the rule. You can use it as an ad-hoc breakpoint or you can put it at the top of the actions to stop all activity, for whatever reason you may have.
It’s obviously not required, but it can be handy when developing rules.

It’s useful if you want to ensure that items processed by a certain rule aren’t processed by other rules (e.g. if this might cause undesired results or conflicts).

Sorry for the delay. I often switch between iPhone and MacBook and don’t want to sync every time. Also if I just add it as a bookmark it’s not on the reading list.

As I already use custom bookmarklets to send URLs to (in order to add them as PDFs via Mail Rule later) I thought that would be the easiest way for the new reading list feature too.

However I can’t get the Mail Rule to act on all Mails with the specific subject. It only acts on the first one, everything else is “lost”. Only workaround so far would be to leave (on Mac) opened all the time, but that’s not really a good idea.

Does anyone have a link to a Mail Rule tutorial or something like that? I would really love to use this setup

Only workaround so far would be to leave (on Mac) opened all the time, but that’s not really a good idea.

Why is that not a good idea ?

Because I shut down my mac sometimes. This “solution” would break when isn’t open