Need an improved version of the Mail scripts

The “Add message(s) to DEVONthink” script that ships with DEVONthink Pro isn’t quite getting the job done for me. Because it converts the messages to plain text, it’s losing a lot of important information (especially with regards to quoted sections in the messages).

So I’m finally going to have to break down and learn how this scripting stuff works. :wink: But in the interest of not re-inventing the wheel, I thought I’d ask here first: Has anyone developed more sophisticated scripts (that they’d be willing to share) for importing messages from into DEVONthink Pro?

Thanks in advance!

Just as a note, DEVONtechnologies is testing an enhanced email archive plugin that can transfer rich text or HTML messages, including attachments.

A public beta may be released in the next month or two (but don’t hold me to a specific date, as it is still in development).


I’m terribly sorry to inform you but you cannot get rich text out of Mail through the scripting interface. There seems to be a bug in AppleScript concerning the transfer of rich text between applications. And like Bill said, we have a plugin coming that gets the information out of Mail exactly the way it looks in that application.
In the meantime there are other solutions but no scripting solution will be able to get the data out of it completely intact.

Just as an option, if you want to all of the formatting of the original message: Print the e-mail, and choose the script “Save to DEVONthink”. This will import the text – exactly as formatted in Mail – without relying on the vagaries of scripted text transfer.


John, that’s an interesting suggestion. I may experiment with that and see how well it works. I do have a lot of older messages that I’d like to import (in bulk), so I’m still stuck on those – but I could try using your technique for any new messages. (FYI, I’m trying to build a database based on postings to a particular mailing list.)

Bill and Annard, thanks for the technical background on the problem. Yes, I’ll be anxious to try out the new plugin when it’s available!

Lyle, as for your past messages, it would not be difficult to write a script to automate the process of generating your old e-mails as PDFs, and then inserting them into your database. If you’d like help writing such a script, I could look into it. The only part I haven’t done before is the “print to PDF” action.


Another thing you can try is to select messages and do a “save as…” in Then select “rich text”.