How to close all open Mac Mail windows using Terminal

0

I have a weird problem in that, upon starting Mail, hundreds of unsent email windows start appearing... these are auto-generated email Alerts created by Google Calendar. It's stuck in some kind of loop. My iMac is useless when Mail is running. Is there a Terminal command to kill these windows? Simply quitting Mail doesn't resolve this issue. thanks!

enter image description here

C.B.

Posted 2018-03-21T19:08:43.360

Reputation: 1

Answers

0

Don't need Terminal, you can do it from Finder...

First - Quit Mail

  • Cmd ⌘ N for new window
  • Cmd ⌘ Shift ⇧ G
  • copy/paste this into the dialog [including the tilde ~]
    ~/Library/Saved Application State/com.apple.mail.savedState
  • Delete the Mail saved state contents.

Launch Mail.

Tetsujin

Posted 2018-03-21T19:08:43.360

Reputation: 22 456

Thanks, Tetsujin. Did as you described - deleted the contents of that folder - restarted Mail... and unfortunately, the windows started appearing again. I returned to the folder assuming to find more (new) items to delete, but there is nothing in this folder. – C.B. – 2018-03-21T19:36:14.690

The saved state ought to only be generated at quit. It does sound like you have some other runaway process, though, so my answer may not be the solution, sorry. Spiff's comment may be a good direction to look, mail rules. – Tetsujin – 2018-03-21T20:07:01.573

0

Launching Mail while holding shift will keep Mail from auto-opening windows you'd previously had open.

Spiff

Posted 2018-03-21T19:08:43.360

Reputation: 84 656

Thank you, Spiff, for your suggestion. But this did not work. Upon restarting Mail (with Shift held) the windows re-appeared. – C.B. – 2018-03-21T19:53:41.807

@C.B. That makes me wonder if you have a mail rule gone wrong. – Spiff – 2018-03-21T20:05:04.957

There's no Mail rule, per se (I checked) but you're on the right track... these emails were all generated by a rule in Google Calendar to send an email Alert. Hundreds of events = hundreds of emails. A blocked SMTP port is keeping them from being sent. Even if I unblock the port, I still have hundreds of email windows that all say, "enter your password". I appreciate all the suggestions! – C.B. – 2018-03-21T20:51:47.267