SmtpException при отправке уведомлений не должна отправляться клиенту

This commit is contained in:
Olga Nemt 2024-03-01 12:06:42 +05:00
parent adf19cf7f7
commit 9b61706f55

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net.Mail;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using AsbCloudApp.Data; using AsbCloudApp.Data;
@ -60,7 +61,15 @@ public class NotificationService
var notificationTransportService = GetTransportService(request.IdTransportType); var notificationTransportService = GetTransportService(request.IdTransportType);
await notificationTransportService.SendAsync(notification, cancellationToken); //todo Добавить задачу в WorkToSendEmail
try
{
await notificationTransportService.SendAsync(notification, cancellationToken);
}
catch (SmtpException ex)
{
Console.WriteLine(ex.Message);
}
notification.SentDate = DateTime.UtcNow; notification.SentDate = DateTime.UtcNow;
await notificationRepository.UpdateAsync(notification, cancellationToken); await notificationRepository.UpdateAsync(notification, cancellationToken);