Error when getting accounts from Mail

My app Mail Archiver uses a lot of AppleScripts via NSAppleScript to get data from Mail or Outlook. I’ve got warnings for Automation access and lots of error handling.

One user got an error when compiling the following script:

with timeout of 10000 seconds
	tell application id ""
		set theAccounts to (get name of accounts)
	end tell
end timeout
return theAccounts

There is, however, no range and no error number.

The Automation part of Security & Privacy doesn’t show anything because he doesn’t even come that far. He has already restarted his computer. I’ve made him an scpt file with the script. And he can’t open the file.

Any idea what could happen here?

macOS 12.0.1

Most likely there is no any internet account activated on the user’s The user should:

  1. Open menu item “Accounts…” of menu “Mail” of
  2. Window “Internet Accounts” opens. The user should drag the internet accounts from right section of this window to the left section of the same window, to activate them for the

No, that’s not the case here.

I made a new user on my MacBook Air with Monterey. It’s not possible to open Mail without creating an account first. I added one account and made the account inactive. The script still compiled and event got a result.

But the problem is moot anyways because the user didn’t get back to me. :frowning:

Another reason for your application to fail could be the following:

  1. User should go to System Preferences → Security & Privacy → Automation
  2. Find in window that opens your Mail
  3. In its sub-items, the user should find and set (check) the checkbox.

NOTE: If it is checked already for old version of, then the user should uncheck it, then check again to activate new setting.

This will allow to your Mail to control

No, this can’t be the reason at all. My app handles everything for the user. The target for all scripts is started, then I check the permissions for AppleScript. The scripts are compiled and executed. For errors the user sees an error message. But I can’t really see why a script can’t be compiled that works for me every day.

What say the compile time error… Pay more attention to the NOTE of my previous post as well.

And, how you handle everything for the user? As I know, this is impossible because the user should to confirm manually (when the dialog appear) to control with your Mail That is, manual actions from user is required to get settings properly.

Also, next time, I recommend writing your applications with the ability to work in debug mode (by switching the value of the debugMode boolean variable), because there are users who find it very difficult to describe the problem.