private string RenderTokenVerificationEmail(string template, string callbackUrl, string code, string email) { var emailModel = new VerificationTokenEmailModel { CallbackUrl = callbackUrl, InformationUrl = Url.Action("Index", "Home", new {}, Request.Url.Scheme), VerificationToken = code, Recipient = email }; var emailBody = razorEngine.RunCompile(template, typeof(VerificationTokenEmailModel), emailModel); return(emailBody); }
private async Task SendNotificationEmail(string userId, string email) { log.Info($"Sending invitation to user {userId}"); var code = await userManager.GenerateEmailConfirmationTokenAsync(userId); var emailModel = new VerificationTokenEmailModel { CallbackUrl = Url.Action("ConfirmEmail", "UserAdministration", new { userId, code, area = string.Empty }, Request.Url.Scheme), InformationUrl = Url.Action("Index", "Home", new { area = string.Empty }, Request.Url.Scheme), VerificationToken = code, Recipient = email }; var emailBody = razor.RunCompile("NewUserInvitation.cshtml", typeof(VerificationTokenEmailModel), emailModel); await userManager.SendEmailAsync(userId, "Invitation to Star Quest by Monkton Stargazers", emailBody); log.Info($"Successfully sent invitation email to user id {userId}"); }