Email archiving with Evernote
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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