This commit is contained in:
2022-03-07 23:01:49 +00:00
parent 5f01dda11a
commit ca9ee50332
2 changed files with 9 additions and 8 deletions

View File

@@ -211,9 +211,9 @@ namespace AyaNova.Biz
//BACKUP
await CoreJobBackup.DoWorkAsync();
if (!KeepOnWorking()) return;
//NOTIFICATIONS
TaskUtil.Forget(Task.Run(() => CoreJobNotify.DoWorkAsync()));
TaskUtil.Forget(Task.Run(() => CoreJobNotify.DoWorkAsync()));//must fire and forget as it will call a report render job. In fact probably all of these can be fire and forget
// await CoreJobNotify.DoWorkAsync();
if (!KeepOnWorking()) return;

View File

@@ -9,7 +9,7 @@ namespace AyaNova.Util
{
public interface IMailer
{
Task SendEmailAsync(string email, string subject, string body, AyaNova.Models.GlobalOpsNotificationSettings smtpSettings, string attachPDF = null);
Task SendEmailAsync(string email, string subject, string body, AyaNova.Models.GlobalOpsNotificationSettings smtpSettings, string attachPDF = null, string forceFileName = null);
}
public class Mailer : IMailer
@@ -19,7 +19,7 @@ namespace AyaNova.Util
}
public async Task SendEmailAsync(string email, string subject, string body, AyaNova.Models.GlobalOpsNotificationSettings smtpSettings, string attachPDFPath = null)
public async Task SendEmailAsync(string email, string subject, string body, AyaNova.Models.GlobalOpsNotificationSettings smtpSettings, string attachPDFPath = null, string forceFileName = null)
{
try
{
@@ -29,17 +29,18 @@ namespace AyaNova.Util
message.Subject = subject;
if (!string.IsNullOrWhiteSpace(attachPDFPath))
{
{
var attachment = new MimePart("application/pdf", "pdf")
{
Content = new MimeContent(File.OpenRead(attachPDFPath), ContentEncoding.Default),
ContentDisposition = new ContentDisposition(ContentDisposition.Attachment),
ContentTransferEncoding = ContentEncoding.Base64,
FileName = Path.GetFileName("test.pdf")
//FileName = Path.GetFileName(attachPDFPath)
FileName = Path.GetFileName(attachPDFPath)
};
if (!string.IsNullOrWhiteSpace(forceFileName))
attachment.FileName = forceFileName;
var multipart = new Multipart("mixed");
if (!string.IsNullOrWhiteSpace(body))
multipart.Add(new TextPart(TextFormat.Plain) { Text = body });