using Microsoft.AspNetCore.Http; using MimeKit; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace My.ProjectName.Services.EmailService { public class Message { public List To { get; set; } public string Subject { get; set; } public string Content { get; set; } public IFormFileCollection Attachments { get; set; } public Message(IEnumerable to, string subject, string content, IFormFileCollection attachments = null) { To = new List(); To.AddRange(to.Select(x => new MailboxAddress(x))); Subject = subject; Content = content; Attachments = attachments; } } }