Question from Niklas dated on 11 Feb 2017
I wanted to use the script for Apple Mail within Devonthink to use it for AirMail. Unfortunately, it did not work. I cannot really say, that I am confident with Apple Script. Can you please help? The script should import all emails to the Inbox.
Answer from 11 Feb 2017
I just ask myself why would you like to import all emails including Spam to DTPO? But does ot matter.
Why do not you use the other way around? This is much easier to get to work directly using AirMail. Just setup a rule and filters within AirMail and export those into a folder. Once set, you can use the folder monitoring within DevonThink to monitor this folder and import all your "cleaned" emails into DTPO.
To setup the folder for DTPO, you click on this folder with the right mouse key and choose "folder actions" there you can use a service or just put the script below into the box.
In the case you like to do a full backup from your emails to DTPO - say once a year or so- you can use Apple Mail as it is much easier with it to import all your emails into DTPO.
This script imports all your emails from a folder into DevonThink Pro:
on adding folder items to this_folder after receiving added_items
if (count of added_items) is greater than 0 then
tell application id "DNtp" to launch
repeat with theItem in added_items
set thePath to theItem as text
if thePath does not end with ".download:" and thePath does not end with ".crdownload:" then
tell application id "DNtp"
set theRecord to import thePath to incoming group
if exists theRecord then tell application "Finder" to delete theItem
end adding folder items to
[bg_collapse view="link" color="#4a4949" icon="arrow" expand_text="Show Help Form" collapse_text="Hide Help Form" ][usp_form id=2191][/bg_collapse]