Browse Source

fix(notifications): 发送邮件通知时需要转换markdown格式.

pull/924/head
unknown 2 years ago
parent
commit
0f37933631
  1. 1
      aspnet-core/Directory.Build.props
  2. 1
      aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Emailing/LINGYUN.Abp.Notifications.Emailing.csproj
  3. 12
      aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Emailing/LINGYUN/Abp/Notifications/Emailing/EmailingNotificationPublishProvider.cs

1
aspnet-core/Directory.Build.props

@ -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>

1
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Emailing/LINGYUN.Abp.Notifications.Emailing.csproj

@ -10,6 +10,7 @@
<ItemGroup>
<PackageReference Include="Volo.Abp.Emailing" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Markdig" Version="$(MarkdigPackageVersion)" />
</ItemGroup>
<ItemGroup>

12
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Emailing/LINGYUN/Abp/Notifications/Emailing/EmailingNotificationPublishProvider.cs

@ -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);
}
}

Loading…
Cancel
Save