Phantom Email Window Keeps Appearing in Apple Mail Apple mail has found itself in a strange state: an email I tried to send this morning (which apparently failed) keeps appearing for perhaps half a second, then disappearing again. This happens even when I restart Mail or even restart the computer. I have tried interacting with it during it's brief appearance (close button, send button, ...) but it doesn't appear to be reacting to my clicks.

Any suggestions on what may be happening or what I can do about it?

EDIT: I have just upgraded from Yosemite to Capitan. Perhaps that's a contributing factor to the behaviour. 

EDIT: I have realised that the phantom window DOES receive keystrokes: if I'm typing into another email when the phantom appears, 3 or 4 keystrokes end up in the phantom, then the subsequent keystrokes appear in the new email after the phantom disappears. It seems the phantom grabs the focus if mail is active - also evidenced by document view popups getting cleared each time the phantom appears.
This seems to be caused by incorrect credentials for the SMTP server that had been associated with the from address of the email. The Inbox for that email now has " - dead" appended to it's name (presumably referring to the SMTP server not working, as am receiving emails). It's a gmail.

As a workaround, first, I can stop the annoying window's phantom behaviour by taking all accounts offline ("Mailbox" menu). Then change the SMTP server for the offending account (fix credentials or use one that works), then re-enabling all accounts. At this point, the phantom email is actually sent and everything seems back to normal.