MailKit fix

master
Tudor Stanciu 2023-01-20 00:44:27 +02:00
parent ccebc134a4
commit 1f7672686b
1 changed files with 2 additions and 1 deletions

View File

@ -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);