I'm likewise as frustrated and fed up with this problem as everyone else is and my conclusion after tonight is that there's some kind of bug that Apple HAVE to get on the case with - I hope we'll see 10.8.1 issued soon with a fix for this. I'm not convinced that playing around with ports or what-have-you has any kind of real bearing.
My other bugbear is that unsent mail goes into a black hole called "Outbox - On My Mac" which you can only locate if you use the smart folder for "Today", otherwise it just disappears and you've no idea where what's going on with your unsent message(s). Very frustrating. Anyway, that's for another thread.
So. I have Gmail set up in my Mail app and I have 2 other (business) addresses set up, both of which receive via my domain's email servers but send via Gmail, as I manage all mail from Gmail. Tonight I received and replied to several emails, all using a business address but sent via Gmail smtp. But one mail in particular was to my work colleague and just would. not. send: period. All the while I was sending happily from my business address to others. Checking the Connection Doctor from time to time showed either all server connections OK (including both Gmail IMAP and SMTP), or one or other server (could be Gmail, could be another) was not connected. This might change from time to time.
Without making any changes at all my message finally sent (manual send, not an automated re-send), some 3 hours after originally written.
However, I don't seem to have any problems using the Mail app or Gmail app on the iPhone - send and receive no bother. iPhone is set up same as Mac in respect of Mail.
Caveat: I did notice that Gmail sometimes misbehaves in any browser (Safari, Firefox, Chrome - all the same). Sometimes loading the page stalls, other times adding attcchments fails. Again, on the iPhone all works fine. I'm beginning to wonder if Apple and Google have gotten into a rift that they'll draw out. I installed ML Fri 27 July and had Mail working perfectly for the entire weekend - then the nasties started happening with last Monday if I recall correctly.
I give up. I'm frustrated as it's already started screwing up my Gmail filing/archiving, having to send via my domain rather than Gmail.
Besides these niggles, I have to say that Mail is finally working the way I need it to work after several years of waiting; quite impressed otherwise. Though messages flagged in Mail sometimes don't show as starred in Gmail though they do filter as being starred - odd.