1

I use the "Copy Message URL" quite heavily in mail app. I would like to paste the link into an org document and make it a clickable link that opens the email in mail.app. This does not currently work. I did try:

[[message://...][email link]]

But this did not work.

3
  • Have you read (info "(org) Adding hyperlink types") in the Org Mode manual?
    – Omar
    Commented Oct 18, 2018 at 12:14
  • I assume you can either call mail.app from the commandline with a message://... argument, or else you can use AppleScript to open the message URL.
    – Omar
    Commented Oct 18, 2018 at 12:16
  • Yes, I did look, but do not know elisp and how to transform the org-man.el into one that will resolve links to mail app.
    – rev
    Commented Oct 19, 2018 at 14:24

2 Answers 2

0

Based on Lars Careliusson's answer, I made it work by doing the following:

When 'Copy Message URL', append %3c and %3e before and after messageid, as suggested by this article. Here is the Applescript from the article:

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

Then, add this to your emacs init file:

(org-add-link-type "message"
 (lambda (id)
  (shell-command
   (concat "open message:" id))))

and the link should be in the following format:

[[<copied_text_from_apple_script>][Subject]]

Alternatively, you can wrap %3c and %3e into the org-add-link-type function and paste the Message ID directly into the org file.

0

This should work:

(require 'org)
(org-add-link-type "message"
 (lambda (id)
  (shell-command
   (concat "open message:" id))))

The link should be in the following format:

[[message:<[email protected]>][Apple Mail Link]]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.