Browse Source
Merge pull request #924 from colinin/fix-notifications
fix(notifications): 发送邮件通知时需要转换markdown格式.
pull/930/head
yx lin
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
14 additions and
0 deletions
-
aspnet-core/Directory.Build.props
-
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Emailing/LINGYUN.Abp.Notifications.Emailing.csproj
-
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Emailing/LINGYUN/Abp/Notifications/Emailing/EmailingNotificationPublishProvider.cs
|
|
|
@ -36,6 +36,7 @@ |
|
|
|
<SixLaborsImageSharpDrawingPackageVersion>2.0.1</SixLaborsImageSharpDrawingPackageVersion> |
|
|
|
<SwashbuckleAspNetCorePackageVersion>6.5.0</SwashbuckleAspNetCorePackageVersion> |
|
|
|
<PollyPackageVersion>8.2.0</PollyPackageVersion> |
|
|
|
<MarkdigPackageVersion>0.34.0</MarkdigPackageVersion> |
|
|
|
<MicrosoftPackageVersion>8.0.*</MicrosoftPackageVersion> |
|
|
|
<MicrosoftEntityFrameworkCorePackageVersion>8.0.0</MicrosoftEntityFrameworkCorePackageVersion> |
|
|
|
<XunitPackageVersion>2.6.1</XunitPackageVersion> |
|
|
|
|
|
|
|
@ -10,6 +10,7 @@ |
|
|
|
|
|
|
|
<ItemGroup> |
|
|
|
<PackageReference Include="Volo.Abp.Emailing" Version="$(VoloAbpPackageVersion)" /> |
|
|
|
<PackageReference Include="Markdig" Version="$(MarkdigPackageVersion)" /> |
|
|
|
</ItemGroup> |
|
|
|
|
|
|
|
<ItemGroup> |
|
|
|
|
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
using LINGYUN.Abp.Identity; |
|
|
|
using LINGYUN.Abp.RealTime.Localization; |
|
|
|
using Markdig; |
|
|
|
using Microsoft.Extensions.Localization; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using Microsoft.Extensions.Options; |
|
|
|
@ -59,6 +60,11 @@ public class EmailingNotificationPublishProvider : NotificationPublishProvider |
|
|
|
{ |
|
|
|
var title = notification.Data.TryGetData("title").ToString(); |
|
|
|
var message = notification.Data.TryGetData("message").ToString(); |
|
|
|
// markdown进行处理
|
|
|
|
if (notification.ContentType == NotificationContentType.Markdown) |
|
|
|
{ |
|
|
|
message = Markdown.ToHtml(message); |
|
|
|
} |
|
|
|
|
|
|
|
await EmailSender.SendAsync(emailAddress, title, message); |
|
|
|
} |
|
|
|
@ -92,6 +98,12 @@ public class EmailingNotificationPublishProvider : NotificationPublishProvider |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// markdown进行处理
|
|
|
|
if (notification.ContentType == NotificationContentType.Markdown) |
|
|
|
{ |
|
|
|
message = Markdown.ToHtml(message); |
|
|
|
} |
|
|
|
|
|
|
|
await EmailSender.SendAsync(emailAddress, title, message); |
|
|
|
} |
|
|
|
} |
|
|
|
|