Importing from Mail


I want to create a database in devonthink Pro of all of the items in (Apple) Mail. I’ve tried running the Import Mail script a couple of times, but it stops several folders in every time. It’s also not (so far) started on the InBox. Is there a trick to this? Is it better to do the import manually (and how would I do that?) - or might there be something awry with my Mail boxes?

I guess I should also ask if there’s a particular way of updating the database without re-importing the whole lot every time.



Hello David,

How many messages are you trying to import? Have you tried doing 1 mailbox at the time? From what I read in the MailScripts Readme (another good set of AppleScripts for Mail not written by us), there are sometimes issues with the AppleScript interface of Mail.

Our scripts will flag the mail messages it has imported so that is one way to see where it was successful.

We are aware that the Mail import situation can be improved. But for now you can either use our scripts or an alternate solution is through the free set of scripts mentioned earlier (there you can create an archive to RTF files that you could import into DT Pro).

hi Annard,

I’m trying to import about 2000 mail items, in about 15 folders. I tried deleting the import and starting again 4 times - strangely, the import gets a bit further every time I run the Import Mail script.

The DTPro tutorial contains the instructions -
(1) Open the folder »Mails« in the folder »Scripts (Additional)« on the DEVONthink Professional disk image.
(2) Copy the script »Import Selected Mail« to the folder »~/Library/Scripts/Mail Scripts«.

The script inside that folder is actually called “Mail Rule Action Import”. I copied this to /users/me/Library/Scripts/Mail Scripts but the script is still called “Import Mail” - there’s no sign of “Import Selected Mail”. (I just tried copying it to the admin level Library - haven’t tried to see what difference that will make yet).

I’m beginning to think that my scripts are all in the wrong place - is there meant to be a DTPro folder inside user/Library/Scripts ? It contains Additions, Applications, Devonthink Pro (again) and Examples. Perhaps I should delete the lot and try again?



Hi David,

What version of the operating system are you using? The note you are referring to is if you want to display our script in Mail’s own Scripts menu and not the Script Menu Extra (this is shown on the right hand side of the menu bar). But this will only work on Panther and not in the new version of Mail in Tiger.

Your message does make it appear to me as if you copied the items from the Install package directly into ~/Library/Scripts. Have you used the “Help->Install Add-ons…” menu from DTPro? That one should install everything in the correct place. So, rename your current ~/Library/Scripts to say ~/Library/ScriptsOld and then try this menu item again. The “Mail Rule Action Import” is not needed unless you want to create a rule in Mail that would automatically import the incoming Mail (depending on a rule you define) to DT Pro.
This is what it looks like for me (on Tiger):

ls -R ~/Library/Scripts
Applications/   DEVONthink Pro/


Mail Rule Action
Add mailbox(es) to DEVONthink.scpt
Add message(s) to DEVONthink.scpt

/Users/annard/Library/Scripts/DEVONthink Pro:
Copy Selection to Incoming.scpt  Link to current document.scpt
Copy Selection to....scpt

There are 2 scripts that you should use: one to import a mailbox and one to import selected messages (in Mail). I would advice to select one mailbox at a time if the mailbox contains a lot of messages. Also, while it is running, keep an eye on the output of the console.log file (start up and you can check it). It may report some problems if the import fails for some reason. You could also check the “Tools->Log” in DTPro.

I’m not sure how I missed it before, but I just discovered the script drop down on the right hand side of the menu bar! (I don’t use scripts a lot - you can tell can’t you :slight_smile: ) So I’ve been doing the import mailbox by mailbox, and it’s ok so far.
I’ll take your advice about reinstalling the scripts - I think I may well have copied the folder manually, and there may even be scripts from Devonthink (pre-Pro) left in there.

I also downloaded and tried the Mailscripts you suggested, but it hung somewhere during the process. One mail box at a time seems to work ok, so I’ll stick with that for now.

thanks for your help.