Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Applescript error using Mail when trying to get a mailbox folder

tell current application

do shell script "/usr/bin/logger -s 'SpamSieve [Apple Mail Server Junk Mailbox] Error -1728 filtering mailbox “Spam” of account “Techworkspro[Gmail]”: Mail got an error: Can’t get mailbox \"Spam\" of account \"Techworkspro[Gmail]\".'"

The above script snippet fails to retrieve an existing mailbox in Google Gmail although it works in other accounts. It is being used in filtering spam. The mailbox exists and has email data in it. So my questions are:

  • What does that error, "Can't get..." mean given that the mailbox exists and it is viewable in Mail for that account?
  • Is there some sort of workaround possible?
  • Is there some sort of troubleshooting to reveal the mailbox issue involved?


This script is used to work with and filter spam messages in Mail.app. Thanks for any guidance!

MacBook Pro, OS X El Capitan (10.11), Retina Display

Posted on Dec 1, 2015 5:36 AM

Reply
1 reply

Dec 1, 2015 4:30 PM in response to HenryS

I'm a little confused by your post.


The script, as written, does nothing more than write a line to the system log. It has nothing to do with accessing any mailbox, spam folder, or anything else... it's just text. It might as well say "I am the President of the United States"... saying it doesn't make it true.


Reading between (or, before) the lines, I'm guessing this line of script is called AFTER the script has tried (and failed) to access the specified mailbox. It's that line of code you should be examining/posting, since that's where the error occurs. This is just some convenience script that tells you about it, and if this is part of a try/on error block it may be a complete misnomer since any error in the script would trigger the exact same log message whether or not the error related to accessing the mailbox in question.

Applescript error using Mail when trying to get a mailbox folder

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.