Skip to content

Instantly share code, notes, and snippets.

@sirtimbly
Created September 8, 2014 19:28
Show Gist options
  • Save sirtimbly/748351ed29c19d4cbf43 to your computer and use it in GitHub Desktop.
Save sirtimbly/748351ed29c19d4cbf43 to your computer and use it in GitHub Desktop.
mail to evernote
-- Slightly modified version of Efficient Computing's AppleScript: http://efficientcomputing.commons.gc.cuny.edu/2012/03/17/copy-email-message-in-mail-app-to-evernote-applescript/
tell application "Mail"
--get selected messages
set theSelection to selection
--loop through all selected messages
repeat with theMessage in theSelection
--get information from message
set theMessageDate to the date received of theMessage
set theMessageSender to sender of theMessage
set theMessageSubject to the subject of the theMessage
set theMessageContent to the content of theMessage
set theMessageURL to "message://%3c" & theMessage's message id & "%3e"
--make a short header
set theHeader to the all headers of theMessage
set theShortHeader to (paragraph 1 of theHeader & return & paragraph 2 of theHeader & return & paragraph 3 of theHeader & return & paragraph 4 of theHeader & return & return)
--import message to Evernote
tell application "Evernote"
synchronize
set theNewNote to (create note with text (theMessageURL & return & return & theShortHeader & theMessageContent))
set the title of theNewNote to theMessageSubject
set the source URL of theNewNote to theMessageURL
set the creation date of theNewNote to theMessageDate
synchronize
end tell
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment