public async Task <string> SendMailAsync(bool SendAsync, string MailTo, string MailToDisplayName, string Cc, string Bcc, string ReplyTo, string Subject, string Body) { GlobalSetting GeneralSettings = await _globalSettingService.GetGeneralSettingsAsync(); if (GeneralSettings.SMTPServer.Trim().Length == 0) { return("Error: Cannot send email - SMTPServer not set"); } string[] arrAttachments = new string[0]; return(await SendMailAsync(SendAsync, GeneralSettings.SMTPFromEmail, MailTo, MailToDisplayName, Cc, Bcc, ReplyTo, System.Net.Mail.MailPriority.Normal, Subject, Encoding.UTF8, Body, arrAttachments, "", "", "", "", GeneralSettings.SMTPSecure)); }
public async Task EmailSendAsync(string email, string subject, string message) { var objGeneralSettings = await _globalSettingService.GetGeneralSettingsAsync(); string strError = await _EmailService.SendMailAsync( false, email, email, "", "", objGeneralSettings.SMTPFromEmail, $"Account Confirmation From: {objGeneralSettings.ApplicationName} {subject}", $"This is an account confirmation email from: {objGeneralSettings.ApplicationName}. {message}"); // if (strError != "") // { // BlazorBlogs.Data.Models.Logs objLog = new Data.Models.Logs(); // objLog.LogDate = DateTime.Now; // objLog.LogUserName = email; // objLog.LogIpaddress = "127.0.0.1"; // objLog.LogAction = $"{Constants.EmailError} - Error: {strError} - To: {email} Subject: Account Confirmation From: {objGeneralSettings.ApplicationName} {subject}"; // _context.Logs.Add(objLog); // _context.SaveChanges(); // } }