Skip to content

Instantly share code, notes, and snippets.

@jkubicek
Created February 25, 2016 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkubicek/99a4b67d240f9dca7415 to your computer and use it in GitHub Desktop.
Save jkubicek/99a4b67d240f9dca7415 to your computer and use it in GitHub Desktop.
Applescript to open the currently selected Mail message in Gmail
tell application "Mail"
set the_messages to selected messages of first message viewer
set the_headers to all headers of item 1 of the_messages
set thecommandstring to "echo \"" & the_headers & "\"| sed -n -e 's/Message-Id: <\\(.*\\)>/\\1/p'" as string
set sedResult to do shell script thecommandstring
set link to "https://mail.google.com/mail/#search/in%3Aanywhere+rfc822msgid%3A" & sedResult
do shell script "open " & link
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment