Create notification email models

This commit is contained in:
Mole
2021-06-04 10:41:17 +02:00
parent 6a79053a9f
commit 8a02118300
2 changed files with 68 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
namespace Umbraco.Cms.Core.Models.Email
{
/// <summary>
/// Represents an email address used for notifications. Contains both the address and its display name.
/// </summary>
public class NotificationEmailAddress
{
public string DisplayName { get; }
public string Adress { get; }
public NotificationEmailAddress(string address, string displayName)
{
Adress = address;
DisplayName = displayName;
}
}
}

View File

@@ -0,0 +1,50 @@
using System.Collections.Generic;
using System.Linq;
namespace Umbraco.Cms.Core.Models.Email
{
/// <summary>
/// Represents an email when sent with notifications.
/// </summary>
public class NotificationEmailModel
{
public NotificationEmailAddress From { get; }
public IEnumerable<NotificationEmailAddress> To { get; }
public IEnumerable<NotificationEmailAddress> Cc { get; }
public IEnumerable<NotificationEmailAddress> Bcc { get; }
public IEnumerable<NotificationEmailAddress> ReplyTo { get; }
public string Subject { get; }
public string Body { get; }
public IList<EmailMessageAttachment> Attachments { get; }
public bool HasAttachments => Attachments != null && Attachments.Count > 0;
public NotificationEmailModel(
NotificationEmailAddress from,
IEnumerable<NotificationEmailAddress> to,
IEnumerable<NotificationEmailAddress> cc,
IEnumerable<NotificationEmailAddress> bcc,
IEnumerable<NotificationEmailAddress> replyTo,
string subject,
string body,
IEnumerable<EmailMessageAttachment> attachments)
{
From = from;
To = to;
Cc = cc;
Bcc = bcc;
ReplyTo = replyTo;
Subject = subject;
Body = body;
Attachments = attachments?.ToList();
}
}
}