feature: expression helpers - basic email sending

This commit is contained in:
Gary Sharp
2024-05-16 22:11:10 +10:00
parent bb846d14c5
commit 78b7b059ea
5 changed files with 47 additions and 2 deletions
+6
View File
@@ -2,6 +2,7 @@
using Disco.Data.Repository;
using Disco.Models.Services.Messaging;
using System;
using System.IO;
using System.Net;
using System.Net.Mail;
@@ -98,6 +99,11 @@ namespace Disco.Services.Messaging
foreach (var recipient in email.BCC)
message.Bcc.Add(recipient);
}
if (email.Attachments.Count > 0)
{
foreach (var attachment in email.Attachments)
message.Attachments.Add(new Attachment(new MemoryStream(attachment.Data), attachment.Name, attachment.MediaType));
}
using (var smtpClient = new SmtpClient(smtpServer, smtpPort))
{