Mail App timing out and having trouble getting and sending mail I'm using El Capitan now...but this problem existed with Yosemite too. 

I keep getting error messages that say either could not connect to server or the server returned the error: Connections to the server “imap-mail.outlook.com” on the default ports timed out...sometimes it's saying that my trash cannot be emptied, other times it says a piece of mail could not be moved to trash.

If I open connection doctor on my original account, it shows two types of connections for each (gmail and hotmail) of my webmail accounts (SMTP and IMAP); for this, I have no idea why! I set up each of these accounts though the mail app, so I did not add them manually that their should be two types of account for each, as I did not choose the type - they are predetermined by the app. 

I spoke with Apple about this and a few other issues a couple weeks ago, and the tech suggested that when I had Apple transfer some files onto this new Macbook from a Windows 8 computer, that something potentially got transferred that was a WIN8 file, that ends up corrupting mail. Didn't make much sense to me sense these are webmail accounts and not discrete files, but what do I know.

He told me to open a new user on the Macbook (as guest user deletes upon shutdown), then open up the mail accounts the same way through the Mail app, and that should fix it. I've now done that, and still...same problem except now, it's not showing two types of webmail for each account, just IMAP. But it currently won't sent the mail I just drafted and i just got the server timed out message.

Since they are webmail accounts, I could just access them online, but I want the organizational features of having them in one place, merging calendars, etc.  

Any help, even an affirmation that this is a bug that others are experiencing, would be much appreciated. I really thought this was an OS X problem and hoped it would be fixed with the release of El Capitan, but no love.
Debugging mail has become a bit cumbersome since the program is now designed to do all of the network requests on background threads and the main UI never blocks. Worse, I don't think there's any way to see important statistics like: What percentage of network requests time out or error? What is the response time for my mail server over time.

With that being said, here are the things I do to isolate and debug mail.


Ensure my Mac has accurate time by enabling Set date and time automatically and manually making the time wrong in the past by 1 minute or more and then enabling the check to ensure my clock will be close to the clocks on the Mail servers.
Make a new user account and only enter one Mail account in that user. This lets me log out of my main user and really focus on one mail server (actually two - one for receiving and another for sending) and makes the debug logs much easier to parse.
In the new account, I don't sign in to iCloud, and when I'm setting up the Mail account, I disable the check mark for Mail and only select Notes - I just want to test the log in and log out first without downloading all the mail initially.
Open up Connection Doctor (under the Window menu or use help to find it)
Enable Log Connection Activity
Press Show Logs


You will now have more data than you might like, but watch for the green light status of the Internet Connection and the status / errors of IMAP/SMTP and other items in the doctor window.

If I don't have a problem and all the lights are green, I quit make and use Finder to navigate up one folder from the logs and compress the entire Mail folder. That gives me a baseline of when things worked.

At that point, if there is an error, you can dig into the logs or post here. You could engage AppleCare or your mail provider for help - and now you have logs. Asking a follow on question with some error message from the logs might also be worth while here. (Or even ask what the various logs mean).

If there isn't an error on the new account, log out of the test Account on your Mac and log back in to your main account and repeat the connection doctor steps. Enable logs there if you find a problem.



TL; DR - your mail issues are the same as my Mail issues and I'm not using exchange, but I do use an IMAP mail server in France which is across the atlantic from where I typically work. My suspicion is that the network errors and time outs are happening and I don't get good feedback when these errors happen and instead Mail hides all the evidence, diligently re-trying a slow connection and in the end making me unhappy. I'm looking to see if I can gather mail statistics so that I can monitor health of my mail connections in aggregate and then choose a faster mail server based on evidence, but so far, I'm only able to find out when the servers are down as opposed to being too slow to effectively work, but up enough to answer Mail's patient requests within 2 minutes so I don't actually get a "failure to connect".