Copy Selected Email Message from Mail.app to Evernote [Applescript]

Posted by on Mar 17, 2012 in Evernote Applescripts | One Comment

Function

Create a new note in Evernote in the default notebook with:

  • the subject of the email as the note title
  • the content of the message as the note body (in rich text formate)
  • the time the email was received as the note creation time

Instruction

  • Select email message in Mail.app (multiple emails can be selected at once, if so, multiple notes will be created in Evernote)
  • Run the script
  • New note(s) created in Evernote under default notebook

Code

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

		--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 (theShortHeader & theMessageContent))
			set the title of theNewNote to theMessageSubject
			set the creation date of theNewNote to theMessageDate
			synchronize
		end tell

	end repeat
end tell

1 Comment

  1. George
    November 12, 2012

    will this script work in Mountain Lion and import attachments as well?

Leave a Reply

css.php