Email service handles errors in try/catch more reliably.

Epub reader seems stable and working.
This commit is contained in:
Joseph Milazzo 2025-07-06 09:56:04 -05:00
parent 0206f376bc
commit f27308190d
4 changed files with 30 additions and 12 deletions

View file

@ -423,11 +423,7 @@ public class EmailService : IEmailService
smtpClient.Timeout = 20000;
var ssl = smtpConfig.EnableSsl ? SecureSocketOptions.Auto : SecureSocketOptions.None;
await smtpClient.ConnectAsync(smtpConfig.Host, smtpConfig.Port, ssl);
if (!string.IsNullOrEmpty(smtpConfig.UserName) && !string.IsNullOrEmpty(smtpConfig.Password))
{
await smtpClient.AuthenticateAsync(smtpConfig.UserName, smtpConfig.Password);
}
ServicePointManager.SecurityProtocol = SecurityProtocolType.SystemDefault;
@ -445,6 +441,12 @@ public class EmailService : IEmailService
try
{
await smtpClient.ConnectAsync(smtpConfig.Host, smtpConfig.Port, ssl);
if (!string.IsNullOrEmpty(smtpConfig.UserName) && !string.IsNullOrEmpty(smtpConfig.Password))
{
await smtpClient.AuthenticateAsync(smtpConfig.UserName, smtpConfig.Password);
}
await smtpClient.SendAsync(email);
if (user != null)
{