fix: correct smtp ssl negotiation mode per port
- Port 465: SslOnConnect (implicit SSL) - Port 587 + UseSsl: StartTls (STARTTLS upgrade) - UseSsl=false: None Ref: IT-628 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -163,7 +163,11 @@ public class AdminChannelsController : Controller
|
|||||||
};
|
};
|
||||||
|
|
||||||
using var client = new SmtpClient();
|
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);
|
await client.ConnectAsync(smtp.Host, smtp.Port, secureSocket, ct);
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(smtp.Username))
|
if (!string.IsNullOrWhiteSpace(smtp.Username))
|
||||||
|
|||||||
Reference in New Issue
Block a user