From 1f7672686bc2be3ae9342b9677fa31dec50aebc7 Mon Sep 17 00:00:00 2001 From: Tudor Stanciu Date: Fri, 20 Jan 2023 00:44:27 +0200 Subject: [PATCH] MailKit fix --- src/Correo.MailKit/MailKitSmtpClient.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Correo.MailKit/MailKitSmtpClient.cs b/src/Correo.MailKit/MailKitSmtpClient.cs index ba47158..3a2d2b2 100644 --- a/src/Correo.MailKit/MailKitSmtpClient.cs +++ b/src/Correo.MailKit/MailKitSmtpClient.cs @@ -3,6 +3,7 @@ using Correo.Abstractions.Extensions; using Correo.MailKit.Extensions; using Correo.MailKit.Models; using MailKit.Net.Smtp; +using MailKit.Security; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using System; @@ -26,7 +27,7 @@ namespace Correo.MailKit var options = _optionsAccessor.Value; _smtpClient = new SmtpClient(); - _smtpClient.Connect(options.Server, options.Port, options.EnableSsl); + _smtpClient.Connect(options.Server, options.Port, options.EnableSsl ? SecureSocketOptions.Auto : SecureSocketOptions.None); if (options.UseAuthentication) _smtpClient.Authenticate(options.Authentication.UserName, options.Authentication.Password);