The log does confirm that imap.gmail.com just stops responding. You had said that turning WiFi off/on seems to fix it for a while. To see if it's a routing problem, run the Network Utility app, select the Ping tab, enter imap.gmail.com in the box, and click Ping. You should see 10 "64 bytes from..." lines, one per second. If that works, try the same in the Traceroute tab. You could try this both under working and failing conditions.I managed to catch it again, this seems to have more IMAP related stuff in it (there's no way to clear the log so it's hard to say which connection it happens to dump into it):
The log does confirm that imap.gmail.com just stops responding. You had said that turning WiFi off/on seems to fix it for a while. To see if it's a routing problem, run the Network Utility app, select the Ping tab, enter imap.gmail.com in the box, and click Ping. You should see 10 "64 bytes from..." lines, one per second. If that works, try the same in the Traceroute tab. You could try this both under working and failing conditions.
Ping has started…
PING gmail-imap.l.google.com (64.233.166.108): 56 data bytes
64 bytes from 64.233.166.108: icmp_seq=0 ttl=44 time=38.780 ms
64 bytes from 64.233.166.108: icmp_seq=1 ttl=44 time=40.622 ms
64 bytes from 64.233.166.108: icmp_seq=2 ttl=44 time=39.177 ms
64 bytes from 64.233.166.108: icmp_seq=3 ttl=44 time=39.734 ms
64 bytes from 64.233.166.108: icmp_seq=4 ttl=44 time=40.876 ms
64 bytes from 64.233.166.108: icmp_seq=5 ttl=44 time=39.345 ms
64 bytes from 64.233.166.108: icmp_seq=6 ttl=44 time=38.842 ms
64 bytes from 64.233.166.108: icmp_seq=7 ttl=44 time=39.172 ms
64 bytes from 64.233.166.108: icmp_seq=8 ttl=44 time=40.286 ms
64 bytes from 64.233.166.108: icmp_seq=9 ttl=44 time=41.029 ms
--- gmail-imap.l.google.com ping statistics ---
10 packets transmitted, 10 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 38.780/39.786/41.029/0.808 ms
Traceroute has started…
traceroute: Warning: imap.gmail.com has multiple addresses; using 64.233.166.108
traceroute to gmail-imap.l.google.com (64.233.166.108), 64 hops max, 72 byte packets
1 speedport.ip (192.168.1.254) 2.167 ms 2.496 ms 1.909 ms
2 rsr1-eru.net.telekom.hu (145.236.226.135) 16.765 ms 16.568 ms 16.914 ms
3 tge0-5-1-3-2105.er1-ip2.net.telekom.hu (84.1.85.248) 17.562 ms 17.785 ms 17.655 ms
4 81.183.3.0 (81.183.3.0) 16.752 ms 17.528 ms 17.454 ms
5 81.183.3.0 (81.183.3.0) 16.951 ms 16.852 ms 17.046 ms
6 81.183.3.137 (81.183.3.137) 17.930 ms 18.116 ms 17.796 ms
7 81.183.2.217 (81.183.2.217) 17.026 ms 19.216 ms 35.699 ms
8 64.233.175.230 (64.233.175.230) 18.605 ms 17.895 ms 16.990 ms
9 209.85.241.233 (209.85.241.233) 33.873 ms 33.403 ms 34.670 ms
10 209.85.251.178 (209.85.251.178) 35.672 ms 35.345 ms 34.762 ms
11 209.85.255.39 (209.85.255.39) 40.256 ms 40.095 ms 41.451 ms
12 209.85.243.67 (209.85.243.67) 42.435 ms 40.279 ms 48.437 ms
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 *
Ping has started…
PING gmail-imap.l.google.com (74.125.195.109): 56 data bytes
64 bytes from 74.125.195.109: icmp_seq=0 ttl=46 time=52.469 ms
64 bytes from 74.125.195.109: icmp_seq=1 ttl=46 time=152.557 ms
64 bytes from 74.125.195.109: icmp_seq=2 ttl=46 time=227.344 ms
64 bytes from 74.125.195.109: icmp_seq=3 ttl=46 time=151.298 ms
64 bytes from 74.125.195.109: icmp_seq=4 ttl=46 time=128.681 ms
64 bytes from 74.125.195.109: icmp_seq=5 ttl=46 time=120.211 ms
64 bytes from 74.125.195.109: icmp_seq=6 ttl=46 time=37.963 ms
64 bytes from 74.125.195.109: icmp_seq=7 ttl=46 time=39.176 ms
64 bytes from 74.125.195.109: icmp_seq=8 ttl=46 time=38.790 ms
64 bytes from 74.125.195.109: icmp_seq=9 ttl=46 time=38.913 ms
--- gmail-imap.l.google.com ping statistics ---
10 packets transmitted, 10 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 37.963/98.740/227.344/63.333 ms
Traceroute has started…
traceroute: Warning: imap.gmail.com has multiple addresses; using 74.125.195.109
traceroute to gmail-imap.l.google.com (74.125.195.109), 64 hops max, 72 byte packets
1 speedport.ip (192.168.1.254) 2.169 ms 1.260 ms 1.944 ms
2 rsr1-eru.net.telekom.hu (145.236.226.135) 16.863 ms 19.116 ms 16.754 ms
3 tge0-5-1-3-2105.er0-ip2.net.telekom.hu (84.1.85.246) 17.853 ms 17.583 ms 17.850 ms
4 81.183.3.6 (81.183.3.6) 17.164 ms 17.410 ms 17.746 ms
5 81.183.3.6 (81.183.3.6) 16.650 ms 17.148 ms 16.764 ms
6 81.183.3.139 (81.183.3.139) 17.586 ms 17.261 ms 18.173 ms
7 81.183.2.217 (81.183.2.217) 16.816 ms 22.851 ms 17.200 ms
8 64.233.175.230 (64.233.175.230) 16.936 ms 18.831 ms 17.147 ms
9 209.85.241.233 (209.85.241.233) 31.816 ms 32.448 ms 32.069 ms
10 209.85.251.178 (209.85.251.178) 34.470 ms 43.131 ms 50.109 ms
11 216.239.47.135 (216.239.47.135) 88.506 ms 55.608 ms 39.071 ms
12 209.85.243.65 (209.85.243.65) 42.829 ms 40.728 ms 39.986 ms
13 * * *
14 wj-in-f109.1e100.net (74.125.195.109) 37.914 ms 38.347 ms 37.792 ms
That's interesting. If what you're seeing is repeatable-- that imap.gmail.com fails when it gets mapped to address 74.125.195.109 -- it would be solid evidence you could show Google to hopefully get them to fix it. I can't think of any good ways to work around this in Apple Mail, since they don't let you change the imap.gmail.com address (likely for security reasons). You may be able to temporarily map it in your /etc/hosts file to a good address, but I don't know if you want to go there.
It's possible that it's just a coincidence that it started failing for you when you went to El Capitan, unless you know it works for other computers or other people using gmail in the same area, same ISP.
Traceroute has started…
traceroute: Warning: imap.gmail.com has multiple addresses; using 66.102.1.109
traceroute to gmail-imap.l.google.com (66.102.1.109), 64 hops max, 72 byte packets
1 speedport.ip (192.168.1.254) 1.880 ms 2.282 ms 1.730 ms
2 rsr1-eru.net.telekom.hu (145.236.226.135) 16.954 ms 17.662 ms 25.403 ms
3 tge0-5-1-3-2105.er1-ip2.net.telekom.hu (84.1.85.248) 23.323 ms 21.905 ms 17.064 ms
4 81.183.3.2 (81.183.3.2) 18.146 ms 17.282 ms 17.005 ms
5 81.183.3.2 (81.183.3.2) 17.053 ms 17.251 ms 16.281 ms
6 81.183.3.139 (81.183.3.139) 17.725 ms 16.668 ms 16.619 ms
7 81.183.2.217 (81.183.2.217) 18.409 ms 16.433 ms 17.891 ms
8 209.85.246.180 (209.85.246.180) 17.184 ms 17.095 ms 17.449 ms
9 216.239.58.8 (216.239.58.8) 34.106 ms 32.961 ms 41.036 ms
10 66.249.95.23 (66.249.95.23) 35.476 ms 35.688 ms 40.381 ms
11 216.239.41.125 (216.239.41.125) 39.040 ms 39.567 ms 39.425 ms
12 209.85.246.51 (209.85.246.51) 39.146 ms 39.040 ms 39.124 ms
13 *
Traceroute has started…
traceroute to googlemail-imap.l.google.com (66.102.1.16), 64 hops max, 72 byte packets
1 speedport.ip (192.168.1.254) 2.419 ms 1.491 ms 2.048 ms
2 rsr1-eru.net.telekom.hu (145.236.226.135) 17.151 ms 16.467 ms 16.138 ms
3 tge0-5-1-3-2105.er0-ip2.net.telekom.hu (84.1.85.246) 17.334 ms 16.932 ms 17.215 ms
4 81.183.3.2 (81.183.3.2) 16.733 ms 17.174 ms 20.275 ms
5 81.183.3.2 (81.183.3.2) 16.912 ms 16.758 ms 17.266 ms
6 81.183.3.139 (81.183.3.139) 16.942 ms 17.194 ms 16.575 ms
7 81.183.2.217 (81.183.2.217) 17.269 ms 17.146 ms 17.007 ms
8 209.85.246.180 (209.85.246.180) 17.211 ms 17.723 ms 16.727 ms
9 216.239.58.8 (216.239.58.8) 30.788 ms 42.181 ms 30.709 ms
10 66.249.95.23 (66.249.95.23) 35.025 ms 34.984 ms 33.905 ms
That's strange, don't know why mine has that choice greyed out for the Gmail account, but since you're past it we can ignore it.I was able to change the incoming mail server from imap.gmail.com to 64.233.166.108 in the Mail settings (I unchecked "Automatically detect settings", closed the window and clicked Save, went back and the incoming mail server was no longer greyed out). It complained about some certificate but it worked, and I was able to send and receive mail for a short while.
But then the exclamation mark came back, saying that the connection to 64.233.166.108 on port 993 timed out. I then checked traceroute for imap.gmail.com and it showed the 74.125.195.109 address.
There is someone else on this WiFi network using some old version of Mail in good old Snow Leopard with Gmail, and has no issues at all.
Some forums suggest using "imap.googlemail.com" instead of "imap.gmail.com" so I tried changing it to that... soon it failed too.
It would be interesting to know what imap.gmail.com maps to on the good Snow Leopard machine. You could also do a Lookup (in Network Utility) on both machines.
Lookup has started…
imap.gmail.com -> 64.233.166.109, 64.233.166.108
Lookup has started…
; <<>> DiG 9.6-ESV-R4-P3 <<>> imap.gmail.com +multiline +nocomments +nocmd +noquestion +nostats +search
;; global options: +cmd
imap.gmail.com. 183 IN CNAME gmail-imap.l.google.com.
gmail-imap.l.google.com. 295 IN A 74.125.71.109
gmail-imap.l.google.com. 295 IN A 74.125.71.108
Traceroute has started…
traceroute: Warning: imap.gmail.com has multiple addresses; using 64.233.166.109
traceroute to gmail-imap.l.google.com (64.233.166.109), 64 hops max, 52 byte packets
1 speedport.ip (192.168.1.254) 2.083 ms 1.714 ms 2.475 ms
2 rsr1-eru.net.telekom.hu (145.236.226.135) 20.003 ms 15.792 ms 15.573 ms
3 tge0-5-1-3-2105.er0-ip2.net.telekom.hu (84.1.85.246) 17.076 ms 16.822 ms 16.943 ms
4 81.183.3.6 (81.183.3.6) 17.879 ms
81.183.3.4 (81.183.3.4) 16.568 ms 16.418 ms
5 81.183.3.4 (81.183.3.4) 16.763 ms
81.183.3.0 (81.183.3.0) 16.070 ms 19.918 ms
6 81.183.3.137 (81.183.3.137) 18.102 ms 16.710 ms
81.183.3.139 (81.183.3.139) 16.749 ms
7 81.183.2.217 (81.183.2.217) 16.800 ms 17.466 ms 16.606 ms
8 64.233.175.230 (64.233.175.230) 18.216 ms
209.85.246.180 (209.85.246.180) 22.551 ms
64.233.175.230 (64.233.175.230) 16.281 ms
9 209.85.242.79 (209.85.242.79) 34.926 ms 34.402 ms
216.239.58.8 (216.239.58.8) 32.596 ms
10 108.170.232.77 (108.170.232.77) 33.891 ms
209.85.251.178 (209.85.251.178) 33.575 ms
108.170.232.77 (108.170.232.77) 37.574 ms
11 209.85.255.39 (209.85.255.39) 42.536 ms
216.239.41.125 (216.239.41.125) 39.341 ms
216.239.49.234 (216.239.49.234) 38.062 ms
12 209.85.246.49 (209.85.246.49) 39.121 ms
216.239.62.155 (216.239.62.155) 38.645 ms
209.85.243.67 (209.85.243.67) 38.447 ms
13 * * *
14 * * *
15 * * *
16 * * *
17 * * *
18 * * *
19 * * *
20 * * *
21 wm-in-f109.1e100.net (64.233.166.109) 36.990 ms 36.599 ms 38.404 ms
These DNS differences may be a red herring, but anyway...
From your Snow Leopard lookup I see it's using the dig command. The El Capitan lookup uses the CFNetwork framework as verified by trying a lookup with WiFi turned off and getting a
kCFErrorDomainCFNetwork error (I believe Mail is also using CFNetwork). That's probably going to make these comparisons not so useful when you do see a failure.
You may know that the DNS service was changed from mDNSResponder to discoveryd in Yosemite, and then back to mDNSResponder in El Capitan --just to keep things lively!
I added my iCloud email account to Mail, and sure enough, the issue happens with iCloud too. So indeed, this has nothing to do with the email providers. It's something else...
That is a stumper. None of the usual cures fit these symptoms. If you're not giving up on Mail, at this point I would watch what's happening on the network using "sudo tcpdump port imaps", and try to spot a difference between Mail and a good client.What could cause all incoming IMAP connections to indiscriminately time out (and never the outgoing connections)? Quitting Mail and relaunching it doesn't fix the problem. Turning WiFi off and on fixes it. Maybe this means that the timeouts can't be a bug in Mail, it must be somewhere outside of Mail. But since both accounts always time out at the same time, it can't be on the server, because they're different servers. So it must be somewhere in between: in the OS, the WiFi hardware, or the router.
Since my WiFi hardware hasn't changed for 3 years and the issue only started happening less than a year ago, I'd guess it's not hardware. My router also hasn't changed for a long time, it used to work fine with this same router and this computer. But my OS did get upgraded, pretty much around when the issue started happening, less than a year ago. I know that tech is always full of coincidences so it's not proof, but it could be the OS. What's in the OS, that has changed between Yosemite to El Capitan, and that could cause all IMAP connections to time out at once?
I tried using other mail clients and they work even when Mail doesn't, so it seems like an issue with Mail after all...