public bool EmailConfirmation(string token, string email, string fullName, string userId) { try { string projectRootPath = _hostingEnvironment.ContentRootPath; var callbackUrl = $"{_settings.EmailURL}/#/Confirmation/{userId}?token={token}"; string confirmationEmailPath = Path.Combine(projectRootPath, "EmailTemplate/ConfirmationEmail.html"); string fileContents = File.ReadAllText(confirmationEmailPath); fileContents = fileContents.Replace("##NAME##", $"{fullName}"); fileContents = fileContents.Replace("##ACTIVATIONLINK##", callbackUrl); EmailLogModel logmodel = new EmailLogModel(); logmodel.Receiver = email; logmodel.Sender = _mailsettings.MailFrom; logmodel.Subject = "Email Verification Notification"; logmodel.MessageBody = fileContents; logmodel.DateCreated = logmodel.DateToSend = DateTime.Now; logmodel.IsSent = false; bool result = SendMail(logmodel.Subject, logmodel.Receiver, logmodel.MessageBody); if (result) { logmodel.DateSent = DateTime.Now; logmodel.IsSent = true; logmodel.Retires++; } else { logmodel.IsSent = false; logmodel.Retires++; } _emailRepository.CreateMail(logmodel); return(true); } catch (Exception ex) { Log.Error(ex); return(false); } }