private async Task SendSummaryEmail(SummaryReportModel userLinkModel, string recipient) { // lookup user var recipientUser = await _userManager.FindByEmailAsync(recipient); if (recipientUser == null) { Logger.LogError("Recipient '{recipient}' not found, can't send email", recipient); return; } // create email model var email = new SummaryReportEmail() { RecipientName = recipientUser.DisplayName, RecipientAddress = recipientUser.Email, ReplyToName = userLinkModel.ReplyToName, ReplyToAddress = userLinkModel.ReplyToAddress, Subject = userLinkModel.Subject, TextBody = userLinkModel.TextBody, HtmlBody = userLinkModel.HtmlBody }; Logger.LogInformation("Sending user link email to '{recipient}'", recipient); await EmailTemplate.SendSummaryEmail(email).ConfigureAwait(false); }
public async Task <bool> SendSummaryEmail(SummaryReportEmail summaryEmail) { var emailTemplate = await GetEmailTemplate(Templates.SummaryReport).ConfigureAwait(false); // use model reply to address emailTemplate.ReplyToAddress = summaryEmail.ReplyToAddress; emailTemplate.ReplyToName = summaryEmail.ReplyToName; await SendTemplate(emailTemplate, summaryEmail).ConfigureAwait(false); return(true); }