How do I get a link to the message?

I’ve been trying to remember how to get a link to the mail message to post in the notes field of Things or a calendar app. I see that there is a @MacSparky TextExpander/AppleScript post from a while back, but is there any way to just see the link? Or is it hidden somewhere deep and inaccessible?

Not sure what mean. Using AppleScript, you can get the message id of the selected message and use that to build a link, Is that not what you are looking for?

1 Like

Things 3 has a helper app that lets you hit a hotkey and get a quick entry with the link to any relevant content (including mail messages) pre filled.

1 Like

There’s an AppleScript here

1 Like

There’s no option to see it in the interface without lifting it with an applescript as far as I know

I use this one to get the URL to selected emails:

tell application “Mail”
set _sel to get selection
set _links to {}
repeat with _msg in _sel
set _messageURL to “message://%3c” & _msg’s message id & “%3e”
set end of _links to _messageURL
end repeat
set AppleScript’s text item delimiters to return
set the clipboard to (_links as string)
end tell

1 Like

Not exactly what you were requesting and is not really automatable in any meaningful way but remember that you can drag the message from to the Things notes field and it will populate the link for you.


Thanks; I keep forgetting that helper app, and I can never remember the key combo, either. I need to hardwire that for a few days of practice, I think.

I wanted to bypass Apple Script and just drag the link the across apps, if possible. I tried to run some of the Apple Scripts I found, but I kept getting “path not found” results. I think I may have missed a check box in one of the security settings for Text Expander, Mail, and Accessibility. I’ll go back and work on it again later.

Thanks for the reply!

When I use this, I get the following output: “Expected expression, property or key form, etc. but found unknown token.”

So I think there’s something wrong with my setup.

I use this Apple Script from @MacSparky (if I remember right) within KeyboardMaestro.

tell application “Mail”
set selMessages to selection
if (count selMessages) > 0 then
set thisMsg to item 1 of selMessages
set thisMsgURL to “message://%3c” & (message id of thisMsg) & “%3e”
tell me to set the clipboard to thisMsgURL
display notification "Message from " & sender of thisMsg & ", subject: " & subject of thisMsg with title “Message Copied”
display notification “Nothing selected.”
end if
end tell

P.S.: Is there a way to get script in here in a more “formatted” (color etc.) way?

So I think I figured this out. I deleted my entire text expander snippet, tried to paste the Apple script again, and we’re back in business.

Linking to messages is still a nightmare, and I wish there was a share sheet in mail on iOS or Mac OS to make this easier, but this workaround looks like it’ll work for me.

At least you can create a „Service“ from any AppleScript.

For instructions on how to see the Message ID in Mail, look here:

Mail Preferences > Viewing > Show message Headers, and add “Message-ID”