Skip to content

Commit 425aeef

Browse files
committed
Default net462 to using Tls12 instead of None (which doesn't work on net462)
See discussion in issue #1952
1 parent 75c858c commit 425aeef

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

MailKit/MailService.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,15 @@ protected MailService (IProtocolLogger protocolLogger)
6767
if (protocolLogger == null)
6868
throw new ArgumentNullException (nameof (protocolLogger));
6969

70+
#if NET462
71+
// Default the SslProtocols value to Tls12 in order to avoid using SSL3 and TLS1.0/1.1 which are
72+
// considered insecure (and is the latest protocol version supported by net462).
73+
SslProtocols = SslProtocols.Tls12;
74+
#else
7075
// Default the SslProtocols value to `None` which allows the operating system to choose the best
7176
// protocol to use and to block protocols that are not secure.
7277
SslProtocols = SslProtocols.None;
78+
#endif
7379
CheckCertificateRevocation = true;
7480
ProtocolLogger = protocolLogger;
7581
}

0 commit comments

Comments
 (0)