DT as Apple Mail archiver?

I’d like to consider using DT to archive email from Apple OS X Mail.

Horrible idea? Decent idea?

And what might I do about folder structure in Mail?

You can easily do this. DEVONthink comes with AppleScript scripts that allow you to copy selected e-mails or complete mailboxe(s) from Apple Mail to your DEVONthink database. And, of course, you can easily recreate the folder structure from Mail in DT. The newest scripts (from DT 1.9.1) leave out all the various headers and copy only the major ones.

What DT can’t do is sync the database with your Mail mailboxes. It really more an archive than a mirror.



I want to import some specific mailboxes into DT as described above.

I’m a long-time Mac owner but was never brave enough (until now) to try Applescripts. Unfortunately, I can’t find the “how to” in the manual or in this forum. Where are these scripts and exactly how do I run them to import my mailboxes?

Thanks for your help!

The scripts are downloaded with the application, in a folder called Scripts (or something close to this – it’s been a while since I’ve dl’ed DT PE, and don’t remember the exact details). You’ll find various scripts in that folder, along with (somewhat terse) documentation that Christian wrote explaining what each script does, and how to install/implement it.

The script that you’re looking for is called something like “Import selected mail.” The documentation will say something like:

Once you’ve installed it per the above instructions, you can access the script from Mail.app’s script menu. Just select an email in Mail, pull down the menu, and select the Import Selected Mail menu item.

Forgive me for being so clueless! In my applications folder, there is only the DT icon (the application) and no DT folder.

I did a Finder search for everything named “DevonThink”. There is a DT folder in my user name–>Library–>Application Support–>DevonThink that contains databases. There is also a folder in my user name–>Library–>Caches–>DevonThink, but no scripts there.

In my Macintosh Hard Drive–>Library–>Scripts folder, there is nothing that says DEVONthink. I did find a Mail Script folder, but nothing in there that says “import mail messages.”

Did I install DT incorrectly? Soon after I installed it, I had computer trouble (unrelated to DT) that required some assistance from AppleCare and using my backup to replace all of my data. It was the first time I’d done this in OS X and it was a bit rocky.

Perhaps I didn’t replace the DT AppleScripts? Or perhaps I need “AppleScript for Dummies!”

When you download DEVONthink as a compressed DMG file and click on it, the DMG opens as a local disk, which contains not only the DT application but other material, including macros and scripts.

Here’s how to solve your problem.

[1] Download DT PE again. Double-click the compressed file to open the DMG as a local disk, which will show up in the Finder.

[2] Go to your Applications folder and create a new folder named something like “DEVONthink PE folder.”

[3] Copy all of the contents of the DT DMG folder into your new DT PE folder inside your Applications folder. Now you have the application plus other material, including a folder named “Scripts & Macros.”

[4] The Scripts & Macros folder holds several scripts that address moving emails from Entourage, Eudora or Mail into your DT database (as plain text only). Open the file named “About these scripts & macros.rtf”. It contains instructions for copying the text of selected messages (alternatively, in the case of Mail. all messages of all mailboxes) into your DT database.

NOTE: Now you can safely discard the original copy of the DT PE application from your Applications folder. If you had set DT to remain in the Dock, drag its icon out of the dock. Now launch DT from the new folder in Applications, click on its icon in the Dock, and select Keep in Dock.

Hope this helps.

Hey, there, Fred & Bill, I’ve gone from AppleScript Dummy to AppleScript Queen. That script called “save to Devonthink” is so much fun! I’m trying them all out (the ones that apply, of course–I don’t use Entourage or Eudora).

As for the installation, I think what I did wrong initially was take the installation instructions too literally. The little window that pops up says to drag the application icon to the applications folder, which I did the first time I downloaded DT. As my kids would say, well, duh!

After reading your instructions, I copied everything in the window, not just the application icon, and dragged it all to the DT folder I created in the applications folder. I’m still finding my way around OS X’s way of doing things. Thanks for helping me out!

Just to know: next month O’Reilly will publish in its famous Missing Manuals-series a manual exclusively dedicated to AppleScript:

see oreilly.com/catalog/applescripttmm

Thanks, Timotheus, I shall look into that book.

Now, regarding importing my e-mail into DT from Mail: The script would only import my e-mail headers, not the messages. I did some research on the forums here and found this thread:

How to make applescript ‘Import selected mail’ work?

…which described the same problem I’m having. The way I read the answer, I figured I was going to have to “take a rich note” one at a time in order to get all my e-mails into DT. But then I found this link on the Apple support forums:

Mail Scripts

…where this guy wrote scripts for Mail and offers them for download. One of them is the “Archive” script, which offers you two options: Archiving your mail into another Mailbox or EXPORTING your mail in text format for import into other applications.

I tried the Export function and it works great. You can specify “All Messages” or only those within dates/times you choose, or even filter your messages. The script puts them in a folder on the Desktop, and you can then import the text files into DT.

It only seems to import them as plain text, though, so any attachments, formatting, etc. are lost.

Generally, yes.

You will probably want to review the information on scripts for Apple’s Mail application in the DT Pro online help. Also keep an eye on the Scripting topic in this forum, as users have posted scripts that you may find useful, or examples that you might wish to modify for your own purposes.

I would probably shy away from a script that automatically deletes all my Mail mailboxes, though. I’d rather do that myself, just in case something goes wrong with the script. :slight_smile:

And you may find some limitations, such as in formatting, and perhaps you may want to keep intact messages with attachments that may not get carried over by a script. Automation is wonderful, but examine the limitations of what you can currently do with scripts and Automator actions, and make certain you can accept any limitations before you delete all of your current mailbox contents. :slight_smile: