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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
17 additions and
1 deletions
-
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 userIds = identifiers.Select(x => x.UserId).ToList(); |
|
|
var userList = await UserRepository.GetListByIdListAsync(userIds, cancellationToken: cancellationToken); |
|
|
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()) |
|
|
if (emailAddress.IsNullOrWhiteSpace()) |
|
|
{ |
|
|
{ |
|
|
|