Can't send using Mail. I get "The SMTP connection to server "smtp.gmail.com" failed." I've tried answers given on this site. Mail>Preferences>Account>Edit Server List etc. Tried re-entering the information (which is unchanged and correct.) Default ports are 25, 465, and 587. Changing to 465 made no difference.

This is happening more and more frequently, and then suddenly it'll correct itself. Extremely frustrating. Right now the list shows both servers are Offline. Why that should be, I don't know.

Any help greatly appreciated.

Cheers,

Giles

Mail 7.3; Mavericks; MacBook Pro
The most common issues with SMTP can come from 


Anti-virus software
Firewalls
ISP Restrictions or Blocks


Since your problem is sporadic, I would guess it isthe Virus app if you have any installed.

There is a test you can do in Terminal with "Telnet"

Basic connectivity test is done with depending on what port you're using to send, type 'telnet smtp.gmail.com 25' or 'telnet smtp.gmail.com 587' in the Terminal prompt window and press Enter

source: http://www.socketlabs.com/blog/diagnosing-smtp-service-connection-issues/