Abstracting MailMessage

This commit is contained in:
Elitsa Marinovska
2020-10-22 15:08:07 +02:00
parent e9ae1a93c3
commit d7eca3d0d5
9 changed files with 68 additions and 60 deletions

View File

@@ -0,0 +1,26 @@
using System;
namespace Umbraco.Core.Models
{
public class EmailMessage
{
public string From { get; }
public string To { get; }
public string Subject { get; }
public string Body { get; }
public bool IsBodyHtml { get; set; } = false;
public EmailMessage(string from, string to, string subject, string body)
{
if (string.IsNullOrEmpty(from)) throw new ArgumentException("Value cannot be null or empty.", nameof(from));
if (string.IsNullOrEmpty(to)) throw new ArgumentException("Value cannot be null or empty.", nameof(to));
if (string.IsNullOrEmpty(subject)) throw new ArgumentException("Value cannot be null or empty.", nameof(subject));
if (string.IsNullOrEmpty(body)) throw new ArgumentException("Value cannot be null or empty.", nameof(body));
From = from;
To = to;
Subject = subject;
Body = body;
}
}
}