67 lines
2.2 KiB
C#
67 lines
2.2 KiB
C#
using DigitalData.Core.Abstraction.Application.Repository;
|
|
using DigitalData.EmailProfilerDispatcher.Abstraction.Entities;
|
|
using EnvelopeGenerator.Application.Configurations;
|
|
using EnvelopeGenerator.Domain.Entities;
|
|
using Microsoft.Extensions.Options;
|
|
|
|
namespace EnvelopeGenerator.Application.Notifications.DocSigned.Handlers;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public class SendSignedMailHandler : SendMailHandler<DocSignedNotification>
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="tempRepo"></param>
|
|
/// <param name="emailOutRepo"></param>
|
|
/// <param name="mailParamsOptions"></param>
|
|
/// <param name="dispatcherParamsOptions"></param>
|
|
public SendSignedMailHandler(IRepository<EmailTemplate> tempRepo, IRepository<EmailOut> emailOutRepo, IOptions<MailParams> mailParamsOptions, IOptions<DispatcherParams> dispatcherParamsOptions) : base(tempRepo, emailOutRepo, mailParamsOptions, dispatcherParamsOptions)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="notification"></param>
|
|
/// <param name="emailOut"></param>
|
|
protected override void ConfigureEmailOut(DocSignedNotification notification, EmailOut emailOut)
|
|
{
|
|
emailOut.ReferenceString = notification.EmailAddress;
|
|
emailOut.ReferenceId = notification.ReceiverId;
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="notification"></param>
|
|
/// <returns></returns>
|
|
protected override Dictionary<string, string> CreatePlaceHolders(DocSignedNotification notification)
|
|
{
|
|
var placeHolders = new Dictionary<string, string>()
|
|
{
|
|
};
|
|
|
|
return placeHolders;
|
|
}
|
|
|
|
private static string TextToHtml(string input)
|
|
{
|
|
if (string.IsNullOrEmpty(input)) return "";
|
|
|
|
// HTML encoding special characters
|
|
string encoded = System.Net.WebUtility.HtmlEncode(input);
|
|
|
|
// Convert tabs to (4 non-breaking spaces)
|
|
encoded = encoded.Replace("\t", " ");
|
|
|
|
// Convert line breaks to <br />
|
|
encoded = encoded.Replace("\r\n", "<br />"); // Windows
|
|
encoded = encoded.Replace("\r", "<br />"); // Mac old
|
|
encoded = encoded.Replace("\n", "<br />"); // Unix/Linux
|
|
|
|
return encoded;
|
|
}
|
|
} |