private async Task SendPasswordResetEmail(ApplicationUser user) { var code = await _userManager.GeneratePasswordResetTokenAsync(user); var callbackUrl = Url.Action(nameof(ResetPassword), "Account", new { protectedSequence = _urlEncoderWrapper.UrlEncode(_protector.Protect(user.Id)), code = code }, protocol: HttpContext.Request.Scheme); var emailBody = _viewRenderer.Render("Account\\ForgottenPasswordEmailTemplate", new ActivationEmailViewModel { User = user, ActivationUrl = callbackUrl }); _backgroundJobClient.Enqueue(() => SendEmail(user, AccountContent.ResetPasswordEmailSubjectText, emailBody)); }
public async Task SendExceptionEmailAsync(Exception e, HttpContext context) { //Orginal: "Features/Messaging/Email/ExceptionEmail" =>Error: Couldn't find view 'Features/Messaging/Email/ExceptionEmail' var message = _viewRenderer.Render("Features/Email/ExceptionEmail", new ExceptionEmailModel(e, context)); await SendEmailToSupportAsync("Exception", message); }
public SearchableArticle(Article article, IViewRenderer viewRenderer) { var descriptionPath = $"Pages/Articles/Intro{article.Id}"; DescriptionPath = descriptionPath; Description = viewRenderer.Render <string>(descriptionPath, null); Href = $"/articles/read/{article.Id}"; Id = article.Id; Title = article.Title; }
public async Task Send <TData>(MailTemplateData mailData, Type template, TData data) { var mailTemplate = _serviceProvider.GetRequiredService(template); if (!(mailTemplate is IMailTemplate <TData>)) { throw new ArgumentException($"{template.FullName} debe implementar la interfaz {typeof(IMailTemplate<>).FullName}"); } (mailTemplate as IMailTemplate <TData>).Data = data; var templateName = mailTemplate.GetType().FullName ?? ""; templateName = templateName.Substring(0, templateName.Length - 5); var body = await _viewRenderer.Render(templateName, mailTemplate); await _email .To(mailData.Emails.Select(email => new Address(email)).ToList()) .Subject(mailData.Subject) .Body(body, isHtml: true) .SendAsync(); }
public void OnGet() { throw new System.ArgumentException("Parameter cannot be null", "original"); ViewRendererTest = _vr.Render("Features/Email/Test", "Hello World"); }
protected override DoNext performInvoke() { _renderer.Render(); return(DoNext.Continue); }
public async Task SendExceptionEmailAsync(Exception e, HttpContext context) { var message = _viewRenderer.Render("Features/Messaging/Email/ExceptionEmail", new ExceptionEmailModel(e, context)); await SendEmailToSupportAsync("Exception", message); }
public void OnGet() { ViewRendererTest = _vr.Render("Features/Messaging/Email/Test", "Hello World"); }