Current state, whatever that means
This commit is contained in:
@@ -3,6 +3,7 @@ using PartSource.Automation.Models.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Mail;
|
||||
using System.Text;
|
||||
@@ -19,7 +20,7 @@ namespace PartSource.Automation.Services
|
||||
_emailConfiguration = configuration.GetSection("emailConfiguration").Get<EmailConfiguration>();
|
||||
}
|
||||
|
||||
public void Send(string subject, string body)
|
||||
public void Send(string subject, string body, Attachment attachment = null)
|
||||
{
|
||||
using SmtpClient smtpClient = new SmtpClient
|
||||
{
|
||||
@@ -31,15 +32,20 @@ namespace PartSource.Automation.Services
|
||||
From = new MailAddress(_emailConfiguration.From),
|
||||
Subject = subject,
|
||||
Body = body,
|
||||
IsBodyHtml = true
|
||||
IsBodyHtml = true,
|
||||
};
|
||||
|
||||
if (attachment != null)
|
||||
{
|
||||
mailMessage.Attachments.Add(attachment);
|
||||
}
|
||||
|
||||
foreach (string address in _emailConfiguration.To.Split(','))
|
||||
{
|
||||
mailMessage.To.Add(address);
|
||||
}
|
||||
|
||||
// smtpClient.Send(mailMessage);
|
||||
smtpClient.Send(mailMessage);
|
||||
}
|
||||
|
||||
public void Send(string to, string subject, string body)
|
||||
@@ -54,7 +60,7 @@ namespace PartSource.Automation.Services
|
||||
From = new MailAddress(_emailConfiguration.From),
|
||||
Subject = subject,
|
||||
Body = body,
|
||||
IsBodyHtml = false
|
||||
IsBodyHtml = false,
|
||||
};
|
||||
|
||||
foreach (string address in _emailConfiguration.To.Split(','))
|
||||
@@ -62,7 +68,7 @@ namespace PartSource.Automation.Services
|
||||
mailMessage.To.Add(to);
|
||||
}
|
||||
|
||||
// smtpClient.Send(mailMessage);
|
||||
smtpClient.Send(mailMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user