Create a gist now

Instantly share code, notes, and snippets.

@manton /evernote.scpt Secret
Last active Aug 26, 2016

What would you like to do?
Email archiving with Evernote
-- http://www.manton.org/2016/08/email-archiving-with-evernote.html
tell application "Mail"
set _selection to selection
repeat with _msg in _selection
set _recipients to to recipients of _msg & cc recipients of _msg
set _sender to sender of _msg
set _text to content of _msg
set _subject to subject of _msg
set _date to date sent of _msg
set _to_string to ""
repeat with _item in _recipients
if _to_string is not "" then
set _to_string to _to_string & ", "
end if
if name of _item is equal to missing value then
set _to_string to _to_string & address of _item
else
set _to_string to _to_string & name of _item & " <" & address of _item & ">"
end if
end repeat
set _note to "From: " & _sender & return & "To: " & _to_string & return & return & _text
tell application "Evernote"
create note with text _note title _subject created _date
end tell
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment