diff --git a/HrynCo.NotificationService.Web/Controllers/Admin/AdminChannelsController.cs b/HrynCo.NotificationService.Web/Controllers/Admin/AdminChannelsController.cs index 4aa3718..d05585d 100644 --- a/HrynCo.NotificationService.Web/Controllers/Admin/AdminChannelsController.cs +++ b/HrynCo.NotificationService.Web/Controllers/Admin/AdminChannelsController.cs @@ -163,7 +163,11 @@ public class AdminChannelsController : Controller }; using var client = new SmtpClient(); - var secureSocket = smtp.UseSsl ? SecureSocketOptions.SslOnConnect : SecureSocketOptions.StartTlsWhenAvailable; + var secureSocket = smtp.Port == 465 + ? SecureSocketOptions.SslOnConnect + : smtp.UseSsl + ? SecureSocketOptions.StartTls + : SecureSocketOptions.None; await client.ConnectAsync(smtp.Host, smtp.Port, secureSocket, ct); if (!string.IsNullOrWhiteSpace(smtp.Username))