Mailbox name into a DTPO group

Is there a script that would take a selected Mailbox, extract its name and create a group in DTPO with the exact same name (either in the global Inbox or even better specifying the Inbox of a particular Database)?

Even better, after creating the group, it would create a subgroup called “Mail” (for example) and every time an e-mail is drop in the corresponding Apple Mail folder, it gets transferred automatically to the DTPO group of the same name (in the subfolder Mail)??

On another topic, DTPO comes with scripts to add mailboxes or messages to DTPO. However, when a message comes with attachments, the attachments do get transferred to DTPO within the message but must be detached in other to have DTPO index them (and being searchable and so on - not sure here if this is true?). Is there a quick and simple way to only send the attachments to DTPO with selecting them and moving them manually to DTPO Inbox or to the sorter?


Please see this new script posted today:

If you have different mailboxes in Apple Mail, each mailbox will have dedicated criteria for which mails get into it, for example “account is = …”.
Now build a rule matching these criteria and attach the script from the article linked above to that rule.

If you don’t modifiy the script, the script will take the name of the rule (which could be the same as the name of your mailbox) to which it is attached and create a folder with that name in the global inbox.

If you open the script and fill in the path to the special database you want the mails to be filed to, it will create that folder (with the name of the rule) in the inbox of that database. Here you can see the path to a database marked yellow, that’s where you have to fill it in:

If you furthermore define a path to a dedicated folder in that database, the script will create that folder (with the name of the group) in that predetermined folder instead of creating it in the inbox.
Here - again marked yellow - I defined that the folder is called ‘Mail’ in that database. Please note the slashes, when you modify the script:

And please note the last line in the picture: This takes care that a subfolder is created, this subfolder is called ‘Attachments’ and to this folder the attachments will get imported in addition to the emails. So the result in DtPO will look like this:

With DtPO 2.3.5 there are new scripts for adding messages and attachments to DtPO. The one you want is called “Add attachments to DEVONthink” and you can start it from the global script menu from the menu bar in OSX - given you still want to use it considering that you already can file the attachments to a dedicated place along with you emails as shown above.

I have to look at my installation since I do not see the new “add Attachment” script.

Now regarding your the script rule described above, one thing is not clear to me into how is addresses the first portion of my post: let’s say a new project come along. 1st action, I create a mailbox Great_Project. This script-rule will automatically create the group of the same name in DTPO by simply selecting it in Mail and launching the script? If it does, the next time something is drop in that mailbox, it will be able to interpret that the group already exist and does not need to create it?

You have to select a mailbox or messages in Apple Mail, before the scripts will be shown from the global script menu in the menu bar. You should find them here: /Users/YourName/Library/Scripts/Applications/Mail/

No, sorry, my fault. My suggestion was based on the idea, that you have different, but more or less fixed mailboxes to which messages arrive, either depending on the account or by rules you have defined. If you would append the script to such a rule (a given one or one to be created) the messages and attachments would get imported automatically to DtPO. You would not have to run the script manually. The script does not take the name of the group, it uses the name of the rule.

Now I understand that you a sorting emails manually into folders on project basis in Apple Mail.

Regarding the first part of your question: Such a script is already installed: Mark the mailbox in Apple Mail and go > menu bar > Mailbox > Add to DEVONthink Pro Office.

Depending on your preferences in DtPO > ‘Import’ the mailbox will be imported to either the global inbox or the inbox of the current database or DtPO will ask you for the location you want to import the mailbox to.
If you import the mailbox every time new mails are in, DtPO will skip the duplicates and only add the new mails.

I do not have that script hat all in my install of 2.3.5. I cannot seem to find it either on Devon website…

If you run from the menu bar > DEVONthink Pro Office > ‘Install Add-ons’ and checkmark the first option “Applications Scripts” these scripts will be installed to /Users/YourName/Library/Scripts/Applications/Mail/.

Otherwise you will find this along with the other new scripts for Mail here:

Finder > menu bar > Go > ‘Go to folder’ … paste this path into the window:
/Applications/DEVONthink Pro Office/DEVONthink Menu/Applications/Mail/
Or do a crtl-click on the app and let the Finder show you the package contents and go to /Contents/Resources/Script Menu/Applications/Mail/