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 <IActionResult> OnGetAsync() { if (Tenant == null || !Tenant.HasValue) { return(RedirectToPage("/Index")); } var address = _userClaimManager.GetEmail(User) ?? User.Identity.Name; var name = _userClaimManager.GetDisplayName(User); Message = new SummaryReportModel(); Message.ReplyToAddress = address; Message.ReplyToName = name; await Load(); await LoadMembers(); return(Page()); }