Thanks! I got it to work now
It looks like that the problem was the names of the accounts. On the drone the account was called “admin” on other devices the name was “admin urnesnet”. In the console under Apple Mail Remote Training it said that it could not find the account “admin urnesnet” (the account name in the script was “admin”).
So the combination of changing the account to “admin urnesnet” and make the TrainXxxx folders manually made it to work. Letting the AppleScript make the TrainXxxx folders it still crashes and the folder do not sync.
The Mail crash report says “Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘Destination store does not have a folder ID’”
Mail crash rapport TrainXxxx folders.txt (92.2 KB)