Browse Source

Merge pull request #1339 from colinin/email-notification

feat(notification): optimize the sending of email notifications
pull/1351/head
yx lin 5 months ago
committed by GitHub
parent
commit
4477a0aa8e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 18
      aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Emailing/LINGYUN/Abp/Notifications/Emailing/EmailingNotificationPublishProvider.cs

18
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"<admin@abp.io>
return $"\"{x.Name}\"<{userEmail}>";
}
return $"\"{x.UserName}\"<{userEmail}>";
})
.Distinct()
.JoinAsString(",");
if (emailAddress.IsNullOrWhiteSpace())
{

Loading…
Cancel
Save