This commit is contained in:
@@ -211,9 +211,9 @@ namespace AyaNova.Biz
|
|||||||
//BACKUP
|
//BACKUP
|
||||||
await CoreJobBackup.DoWorkAsync();
|
await CoreJobBackup.DoWorkAsync();
|
||||||
if (!KeepOnWorking()) return;
|
if (!KeepOnWorking()) return;
|
||||||
|
|
||||||
//NOTIFICATIONS
|
//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();
|
// await CoreJobNotify.DoWorkAsync();
|
||||||
|
|
||||||
if (!KeepOnWorking()) return;
|
if (!KeepOnWorking()) return;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace AyaNova.Util
|
|||||||
{
|
{
|
||||||
public interface IMailer
|
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
|
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
|
try
|
||||||
{
|
{
|
||||||
@@ -29,17 +29,18 @@ namespace AyaNova.Util
|
|||||||
message.Subject = subject;
|
message.Subject = subject;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(attachPDFPath))
|
if (!string.IsNullOrWhiteSpace(attachPDFPath))
|
||||||
{
|
{
|
||||||
var attachment = new MimePart("application/pdf", "pdf")
|
var attachment = new MimePart("application/pdf", "pdf")
|
||||||
{
|
{
|
||||||
Content = new MimeContent(File.OpenRead(attachPDFPath), ContentEncoding.Default),
|
Content = new MimeContent(File.OpenRead(attachPDFPath), ContentEncoding.Default),
|
||||||
ContentDisposition = new ContentDisposition(ContentDisposition.Attachment),
|
ContentDisposition = new ContentDisposition(ContentDisposition.Attachment),
|
||||||
ContentTransferEncoding = ContentEncoding.Base64,
|
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");
|
var multipart = new Multipart("mixed");
|
||||||
if (!string.IsNullOrWhiteSpace(body))
|
if (!string.IsNullOrWhiteSpace(body))
|
||||||
multipart.Add(new TextPart(TextFormat.Plain) { Text = body });
|
multipart.Add(new TextPart(TextFormat.Plain) { Text = body });
|
||||||
|
|||||||
Reference in New Issue
Block a user