Mail · AppleScripts

Copy Message Link

    An AppleScript to quickly copy the links (message://...) of the selected email messages to the clipboard (written by John Gruber).

Not every application creates links to email messages via drag & drop. With this script you can just copy the link to the message to the clipboard and paste it wherever you want. Right-click, choose Open URL and the email message will open right up. You may even drag the URL to the desktop or a folder.

For more information on this script and email URLs in Mac OS X read the entire post on Daring Fireball.

Save the script to ~/Library/Scripts/Applications/Mail/ and run it via the AppleScript Menu or use a third-party application like FastScripts to easily assign a keyboard shortcut to the script.

show source AppleScript Editor open download

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