C-Command Software Forum

Remote training, AppleMail and Protonmail

A couple of questions for ya 'all. First, when you setup Remote Training and place emails into the requisite folders, are the emails supposed to stay in these folders? Or is the script supposed to move the emails into the InBox or Junkmail folder after processing them?

Second, I’m using Protonmail with AppleMail (they provide a gateway). I cannot move the TrainGood and TrainSpam folders to the root. The only way you can add folders is in the root Folders folder. It looks like Remote Training is not finding them. Other than that, it’s is working with Protonmail.



The script will move them after it’s trained them.

The script looks for top-level mailboxes. Is it possible for you to set your account’s IMAP Path Prefix in Apple Mail’s preferences so that the contents of Folders appear at the top level?

Thanks, Michael-

Well I guess that means the script is not working. It does not throw a error when it’s run and I can’t seem to find the log that might tell me what’s going on.

I have no idea what to put in the IMAP Path Prefix. Any pointers on that?


You can see what it’s doing by searching Console for “Rescue Good Messages”, and there is also a debug option to enable additional logging.

It should be set to the name of the mailbox that contains your desired top-level mailboxes. Usually this is INBOX, but in your case perhaps it should be Folders.

I can’t use the IMAP path as then it won’t go to my INBOX, just the FOLDERS folder.

Nothing comes up in console when I put in your query. When I run the script manually, it seems to work for the other accounts… It is supposed to kick off every time an email comes in?

I changed the rule to run when an email comes it with “Run training” in the subject. That seems to work. Is it possible to modify the script to:, if exists mailbox “Folders:TrainSpam" of _account then

OK, I didn’t realize that you had some mailboxes that were not in Folders.

You should enter the query first, then run the script.


That shouldn’t be necessary—the Every Message condition should match a superset of what your subject condition does. Is your rule at the top of the list?

I’ve updated the script to find the mailboxes inside of Folders (and in other nested locations).

Thank you for that! But, I still can’t seem to get the script running. In your instructions you say that if you are using “spam” you have to put in mail account names in the script. This implies to me that if you are using “junk” you don’t have to, just run the script. But I get the error "error “Mail got an error: Can’t get account “Account 1”.” number -1728 from account “Account 1"”. When I do add the account names, the script returns “” as a result and does not move the emails from the “TrainGood” and “TrainSpam” folder.

Yes, the account names should be unnecessary if you are using Junk, i.e. you’ve told SpamSieve that using the Change Settings command.

If you still can’t get it to work, please set pEnableDebugLogging to true, and then you can search the Console app for MJTLog before you run the script, and then it should show status messages while the script is running to show what it’s doing.

What I get is: SpamSieve [Apple Mail Remote Training MJTLog] Error training from account “{redacted}”: Mail got an error: Can’t get mailbox “Spam” of account id “67888B98-A5E5-485A-B571-10C95B9E7529”.

And I get: OSErr AEGetParamDesc(const AppleEvent *, AEKeyword, DescType, AEDesc *)(----) as utf8 = "/usr/bin/logger -s ‘SpamSieve [Apple Mail Remote Training MJTLog] Error training from account “{redacted}”: Mail got an error: Can’t get mailbox “Spam” of account id “67888B98-A5E5-485A-B571-10C95B9E7529”.’ err=0/noErr

What is the date at the top of the script that you are running?

Last Modified: 2021-09-20

It really sounds SpamSieve is not set to use the Junk mailbox, i.e. in Change Settings you need to answer Yes for When you choose “Train as Spam,” should the spam messages be moved to the special Junk mailbox?. If that’s not the problem, please e-mail me your script file and a diagnostic report and I’ll take a closer look.