diff -up fetchmail-6.3.26/socket.c.orig fetchmail-6.3.26/socket.c
--- fetchmail-6.3.26/socket.c.orig	2018-09-24 11:40:26.324633999 +0200
+++ fetchmail-6.3.26/socket.c	2018-09-24 11:40:37.437652606 +0200
@@ -1029,6 +1029,20 @@ int SSLOpen(int sock, char *mycert, char
 	_verify_ok = 1;
 	_prev_err = -1;
 
+	/*
+	 * Support SNI, some servers (googlemail) appear to require it.
+	 */
+	{
+	    long r;
+	    r = SSL_set_tlsext_host_name(_ssl_context[sock], servercname);
+
+	    if (0 == r) {
+		/* handle error */
+		report(stderr, GT_("Warning: SSL_set_tlsext_host_name(%p, \"%s\") failed (code %#lx), trying to continue.\n"), _ssl_context[sock], servercname, r);
+		ERR_print_errors_fp(stderr);
+	    }
+	}
+
 	if( mycert || mykey ) {
 
 	/* Ok...  He has a certificate file defined, so lets declare it.  If
