Mac Email Link in Markdown Editor

When typing a note in the markdown editor in DTTG on iPad, it is quite easy to drag an email into the markdown editor to create a link back to the email. On DT on Mac, the same functionality does not appear to exist. If I drag an email on Mac from Apple Mail into the DT markdown editor, you don’t get a link.

Am I missing something?

Is there an easy way to get the link into the markdown editor?

Just to clarify…
Dragging and dropping an email into a Markdown file doesn’t create a valid Markdown link automatically.

This is currently not supported in DEVONthink but could likely be scripted if more information was supplied.

Thanks for the response. I figured that was the case.

Can you let me know what information would be needed to script this?

Not supported by DT3 but this may help.

Hook – Links beat searching

Thanks for the tip. I will check it out.

Are you using the subject as the link text?

So if you had hook, what you would do is bring up the hook window with a short cut, usually command- shift-space bar, then command-M to copy a markdown link to clipboard, then paste it into your source markdown document in DT3.

On DTTG on iPad, I often use the subject line as the link. But I more often just copy the link and create a new link in markdown after I pull it in.

All I want is an easy way to get the mail link into a markdown document inside DT. I know I can use a third-party app to create the note and do it easily. I would like to work exclusively in DT.

Would Hook grab the native Mac URL for the email or does it create a proprietary link?

The links are in the form of [Name of item](hook://email/…). They are “Hook” links, advantages are they are robust (i.e. don’t break if move or rename), disadvantages are few, but one you might not like is that they won’t work on iOS/DTTG, they are Mac only. Theres a few short videos available to see if it would help with your specific workflows.

1 Like

Thanks so much for the help!

I wrote a TextExpander AppleScript snippet that outputs the URL for the selected mail message in Apple Mail. David Sparks did a write up of it on his blog.

The benefit of using the “message://” URL scheme is that the links work on macOS, iOS, and iPad OS.

I hope this helps.

1 Like

@JacobIO Thanks for the tip. I was able to set it up with text expander, but I could not get it to produce the correct link. I checked it against simply dragging the mail message into TextEdit, which gives you a link. The two links were slightly different.

Any idea why?

Again, thanks for the help. If I can get it to work, it would be really great.

Could you post the links?



This worked for me:

tell application “Mail”
set selectedMessages to selection
set theMessage to item 1 of selectedMessages
set messageid to message id of theMessage
– Make URL (must use URL-encoded values for “<” and “>”)
set urlText to “message:” & “%3c” & messageid & “%3e”
return urlText
end tell