Eisenhower, as chief of the European theater during WWII had an affair with his woman driver - I think her name was Kay Summersby - and then he went on to serve two terms as president.
Maybe. Maybe not. There's never been any conclusive evidence of this claim.
As I recall there were at least two Republican candidates who ran for the nomination this year that were known to have had affairs and one continued to be a great Speaker of the House.
Of course in those days email mining was not even on the radar.