From 206ae92808224dfdaee394720eb206cef62ae5d4 Mon Sep 17 00:00:00 2001 From: colin Date: Mon, 13 Oct 2025 15:44:53 +0800 Subject: [PATCH] feat(notification): optimize the sending of email notifications - The recipient uses a username-friendly identifier --- .../EmailingNotificationPublishProvider.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Emailing/LINGYUN/Abp/Notifications/Emailing/EmailingNotificationPublishProvider.cs b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Emailing/LINGYUN/Abp/Notifications/Emailing/EmailingNotificationPublishProvider.cs index 1ecbbf5bb..01ba8ae8f 100644 --- a/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Emailing/LINGYUN/Abp/Notifications/Emailing/EmailingNotificationPublishProvider.cs +++ b/aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Emailing/LINGYUN/Abp/Notifications/Emailing/EmailingNotificationPublishProvider.cs @@ -26,7 +26,23 @@ public class EmailingNotificationPublishProvider : NotificationPublishProvider { var userIds = identifiers.Select(x => x.UserId).ToList(); var userList = await UserRepository.GetListByIdListAsync(userIds, cancellationToken: cancellationToken); - var emailAddress = userList.Where(x => x.EmailConfirmed).Select(x => x.Email).Distinct().JoinAsString(","); + + var emailAddress = userList + .Where(x => x.EmailConfirmed) + .Select(x => + { + var userEmail = x.Email; + if (!x.Name.IsNullOrWhiteSpace()) + { + // "admin" + return $"\"{x.Name}\"<{userEmail}>"; + } + + return $"\"{x.UserName}\"<{userEmail}>"; + }) + .Distinct() + .JoinAsString(","); + if (emailAddress.IsNullOrWhiteSpace()) {