public async Task ProcessEvent(OrderCreated data) { // get data var eventData = await eventsApi.ApiEventsByIdGetAsync(data.EventId); var orderData = await ordersApi.ApiOrdersByOrderIdGetAsync(data.OrderId); var allRegistrations = await eventsApi.ApiRegistrationsByEventIdGetAsync(data.EventId); var orderRegistrations = allRegistrations.Where(r => r.OrderId == data.OrderId).ToList(); // prepare template var mailData = new RegistrationConfirmationDTO() { Event = eventData, Registrations = orderRegistrations }; // prepare template var template = await mailTemplatesFacade.ResolveTemplate(MailIntent.RegistrationConfirmed, orderData.LanguageCode, orderData.EventId); var globalTemplate = await mailTemplatesFacade.ResolveTemplate(MailIntent.GlobalTemplate, orderData.LanguageCode, orderData.EventId); // send e-mail await mailerService.SendMail(orderData.BillingAddress.ContactEmail, template, globalTemplate, mailData); }
protected override void LogMessageCore(string message, IDictionary <string, string> additionalData, Severity severity) { var output = WebUtility.HtmlEncode(message).Replace("\r\n", "<br />").Replace("\r", "<br />").Replace("\n", "<br />"); output = $"{dateTimeNowProvider.Now:yyyy-MM-dd HH:mm:ss}<br />" + output; mailerService.SendMail(recipientAddress, "Error Report", output); }
public async Task ProcessEvent(OrderCreated data) { // get data var orderData = await ordersApi.ApiOrdersByOrderIdGetAsync(data.OrderId); // prepare template var template = await mailTemplatesFacade.ResolveTemplate(MailIntent.ExternalInvoiceRequest, orderData.LanguageCode, orderData.EventId); var globalTemplate = await mailTemplatesFacade.ResolveTemplate(MailIntent.GlobalTemplate, orderData.LanguageCode, orderData.EventId); // send e-mail await mailerService.SendMail(orderData.BillingAddress.ContactEmail, template, globalTemplate, orderData); }
public ActionResult ForgotPassword(string email) { var userManager = HttpContext.GetOwinContext().GetUserManager <UserManager <IdentityUser> >(); var user = userManager.FindByEmail(email); if (user != null) { string resetToken = userManager.GeneratePasswordResetToken(user.Id); string resetUrl = Request.Url.GetLeftPart(UriPartial.Authority) + "/Account/ResetPassword?email=" + email + "&token=" + resetToken; string link = string.Format("<a href=\"{0}\">Reset your password</a>", resetUrl); //userManager.SendEmail(user.Id, "your password reset token", message); EmailMessageMaker forgotPasswordEmail = new EmailMessageMaker(); forgotPasswordEmail.Line.Add("<h2>Thank you for contacting us!</h2>"); forgotPasswordEmail.Line.Add("<p>To reset your password, please click on the link below.</p>"); forgotPasswordEmail.Line.Add(link); forgotPasswordEmail.Line.Add("<p>Have a great day!</p>"); MailerService passwordReset = new MailerService(user.Email, "Instructions to reset your VGM password", forgotPasswordEmail); passwordReset.SendMail(); } return(RedirectToAction("ForgotPasswordSent")); }