C-Command Software Forum

Mail Crashing: Culprit apple-mail-server-junk-mailbox?

For months I’ve been having problems with Apple Mail crashing all the time. This seems to happen when a little spinning gear shows up in my menu bar indicating that the apple-mail-server-junk-mailbox script is running. It offers an option to cancel the script by clicking on a little ‘x’ but that never does anything. Sometimes it looks as if there are multiple instances of the script running. I’ve attached a screenshot of this problem.

Suggestions? Solutions?

Screen Shot 2015-09-22 at 7.42.57 AM.png

What you are describing sounds like a hang, rather than a crash. My guess is that this is happening because you have a large number of messages in the Junk mailbox and Mail is taking a long time to find these and report back to the script. The messages might not appear in Mail itself (because the messages are marked as deleted but have not yet been expunged), but you should be able to see and delete them if you log into your account via Webmail.

Also, as a general troubleshooting tip, you can run the script in Script Editor to see which line of the script is taking a long time. That will usually point to the cause of the problem.

Thanks for the suggestions but it’s less time and hassle to Force Quit and restart than log into Webmail and started manually deleting emails. I wish there was another way…

Just had the problem again though this time it didn’t show the spinning gear in the menu bar. I went to Activity Monitor and recorded a sample. File attached.

Sample of Mail.txt (1.69 MB)

Usually when I have seen this problem, you only have to go into Webmail once to clean things out.

In this case, a script had asked Mail to flag a message, and this process was blocked because there were a large number of messages that Mail was in the process of moving to the trash. By default, the Server Junk Mailbox script does not flag messages or move them to the trash. Did you edit the script options to make it do this? Or are you running another script that does these things?

You helped me set this up so that I could easily identify what was spam by having it flagged. I’ve attached a snapshot of the rules I’m running and I also have the apple-mail-discard-spam script at the ready in my menu bar for automatically deleting the spam messages that are in the Trash though for fear of having Mail hang, I go back and forth between that and manually choosing and deleting. I don’t know that that script has actually caused any problems, just that Mail hangs all the time forcing me to Force Quit.

For me it’s not enough to just have the spam sent to Trash. I need it completely zapped and gone forever (until it comes back in a new wave 10 mins. later).

Since I set this up, if there’s a new and better way of doing this, I’d love to know. How about SpamSieve for ISP’s so it never gets to my IN box in the first place!

Screen Shot 2015-09-25 at 4.36.08 PM.png

Have you tried cleaning out the deleted messages via Webmail?

That script, at least the current version, only empties the Spam mailbox. It does not touch messages that are already in the trash.

I will see whether there is a way to make the script more efficient.

Hi Michael,

I turned off the Server Junk Mailbox SpamSieve rule a while back because Mail just kept hanging, forcing me to continually force quit. I tried your suggestion of deleting messages through Webmail but that didn’t help. Just the other day I clicked the rule back on and it immediately hung again with THREE instances of the rule running at the same time. Clicking the little ‘x’ to stop the scripts did nothing so I once again had to force quit just to get back into Mail to turn it off.

At this point, I’m better off manually deleting spam messages but that’s tedious and not why I purchased your software. I know it’s great software because I’ve been using it for years. Perhaps it’s the updates from Apple that have been causing these problems (wouldn’t surprise me one bit - they can’t leave well enough alone and somehow have the idea that they need to continually improve and innovate when all they end up doing is f’ing things up more!)?

What do you suggest? You’ve been very helpful with your communication and I’ve tried everything you’ve suggested but I’m stuck.

I am working on speeding up the script and also adding ways for it to report the sources of the slowness. In the meantime, one option would be to run the script manually, once in a while (e.g. from the Script menu), to clean out the Junk mailbox, rather than having the Mail rule run it each time a new message arrives.

That’s great - thanks. How will I know when it’s available?

I will post here, or you could e-mail me and I’ll notify you that way.

The new and improved script is now available. Please be sure to set pEnableDebugLogging to true.