Skip to content

Instantly share code, notes, and snippets.

@manton
Last active August 26, 2016 19:11
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 manton/d51e12c93ff00435f929c84890d27717 to your computer and use it in GitHub Desktop.
Save manton/d51e12c93ff00435f929c84890d27717 to your computer and use it in GitHub Desktop.
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