Example #1
0
        public async Task <string> SendMailAsync(bool SendAsync, string MailTo, string MailToDisplayName, string Cc, string Bcc, string ReplyTo, string Subject, string Body)
        {
            GeneralSettings GeneralSettings = await _generalSettingsService.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));
        }
Example #2
0
        public async Task EmailSendAsync(string email, string subject, string message)
        {
            var objGeneralSettings = await _GeneralSettingsService.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();
            }
        }