fix: Register CodePagesEncodingProvider for Limilabs Mail.dll compatibility
- Add static constructor to register System.Text.Encoding.CodePages - Required for windows-1252 and other extended code page support - Fixes encoding issues with international email content
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Text;
|
||||||
using DigitalData.EmailProfiler.Application.Common.Dtos;
|
using DigitalData.EmailProfiler.Application.Common.Dtos;
|
||||||
using DigitalData.EmailProfiler.Application.Common.Interfaces;
|
using DigitalData.EmailProfiler.Application.Common.Interfaces;
|
||||||
using DigitalData.EmailProfiler.Domain.Exceptions;
|
using DigitalData.EmailProfiler.Domain.Exceptions;
|
||||||
@@ -19,6 +20,12 @@ public class LimilabsEmailService(
|
|||||||
{
|
{
|
||||||
private readonly EmailAccountDto _smtpAccount = smtpConfig.Value;
|
private readonly EmailAccountDto _smtpAccount = smtpConfig.Value;
|
||||||
|
|
||||||
|
// Register encoding provider for Limilabs (requires windows-1252 and other code pages)
|
||||||
|
static LimilabsEmailService()
|
||||||
|
{
|
||||||
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task SendEmailAsync(string to, string subject, string body, bool isHtml = true, CancellationToken cancellationToken = default)
|
public async Task SendEmailAsync(string to, string subject, string body, bool isHtml = true, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
using var smtp = new Smtp();
|
using var smtp = new Smtp();
|
||||||
|
|||||||
Reference in New Issue
Block a user