Import Mail.app “Notes” Into Evernote
February 25th, 2009 | Published in ruby | 20 Comments
Updated 12/16/2012 to add a contributed AppleScript to import notes from Mountain Lion’s Notes.app to Evernote
Updated 5/25/2010 to add the creation date of the Mail.app note to the imported Evernote item.
Mail.app has these things it can store called “notes.” Along with mail-based todos, they’re meant to turn Mail.app into more of a productivity hub. I don’t have a strong opinion about them, mostly because they’re an absolute nightmare if you make the mistake of letting them come near a Gmail account, which I did. The experience was unpleasant enough that I never decided whether I liked them away from a Gmail account or not.
Another weird thing about Notes from a scripting perspective is that when they aren’t tied to an e-mail account, they don’t seem to exist in any way you can get at them if you store them in their little “Notes” hierarchy. Mail.app’s scripting dictionary doesn’t acknowledge the existence of a specific class of things called notes, and scripts don’t find anything inside the folders holding them. AppleScripts trying to talk to the mailbox “Notes” compile but don’t do anything. appscript scripts claim that they’ve got a reference to the mailbox, but return an empty array when you ask for the items within.
Someone on the Evernote forums, however, had a good enough experience with them that he had 400 he wanted to move from Mail.app into Evernote (so I guess the experience wasn’t that great in the end). Like I said, I don’t even care about notes, but I did think “I’ve already done that with messages in Evernote, so I’m sure I can easily repurpose that.” That’s when I discovered the existenceless existence of Notes.
It turns out, though, that you can just make a new mailbox on your Mac and drag all your notes into it, at which point they become messages for purposes of scripting them. The first line of the note is the “message” “subject,” and every line of the note including the first is the “message” “content.”
Once I had that worked out, it was easy to mass import a sample of test notes into Evernote:
I ended up deciding to do it in Applescript when I realized Ruby probably would not be helpful to the original poster. If you count the shebang and require lines, it took 18 more characters in Ruby than in AppleScript.
Here’s another one, contributed in the comments by Lee, for using the new Notes.app found in Mountain Lion:
