/// <summary> /// Prepare and sens the payment successful method. /// </summary> /// <param name="ChargeID">Stripe charge ID</param> private async Task <bool> PrepareAndSendPaymentSuccessfulEmail(string ChargeID) { var retVal = false; try { var user = await _iHttpContextProvider.GetCurrentUser(); if (!string.IsNullOrEmpty(user.Email)) { //Get the template var template = File.ReadAllText(HttpContext.Current.Server.MapPath("~/App_Data/Payment Confirmation Email.html")); //Replace the link. template = template.Replace("{%PaymentReferenceNo%}", ChargeID); template = template.Replace("{%UserName%}", user.UserFullName); _emailApplicationService.SendAnEmail(template, user.Email, AppLocalizer.SubscriptionRenewed); retVal = true; } } catch (Exception) { //Do Nothing.. } return(retVal); }
public async Task <string> SendRegisterationLink(string UserEmail) { //Get the registration token var token = await _userClient.GetRegistrationToken(UserEmail); //Get the template var template = File.ReadAllText(HttpContext.Current.Server.MapPath("~/App_Data/Registration Email.html")); //prepare the registration Link. var link = string.Format(ConfigurationManager.AppSettings["UserRegisterRedirectionLink"] + "?email={0}&token={1}", UserEmail, token); //Replace the link. template = template.Replace("{%RegistrationLink%}", link); template = template.Replace("{%EmailID%}", UserEmail); //Send an email. _emailApplicationService.SendAnEmail(template, UserEmail, AppLocalizer.UserRegistrationLink); //return the registration token return(token); }