public void SendVerificationLink(string verificationToken, string emailAddress) { //Send verification link via email int userId = MollShopContext.FindUserIdByEmail(emailAddress); string messageBody = @"<body style='box-sizing: border-box;font-family: "Lato", "Lucida Grande", "Lucida Sans Unicode", Tahoma, Sans-Serif;width: auto;height: 100vw;margin: 0 0 0 0;'> <div id='section_form' style='box-sizing: border-box;background: #f4f4f4;padding-top: 2vw;padding-bottom: 5vw;'> <img id='circlelogo' src='https://i.imgur.com/lrkjNdQ.png' style='box-sizing: border-box;width: 8vw;height: auto;margin: auto;display: block;position: relative;top: 20px;z-index: 999;'> <div id='rectangle' style='box-sizing: border-box;;width: 40vw;height: auto;background: white;padding: 30px;margin: auto;border-radius: 30px;z-index: 950;'> <div class='registrationform' style='box-sizing: border-box;'> <table style='box-sizing: border-box;border: 0px solid #ffac35;margin: auto;text-align: center;font-size: 16px;margin-top: 20px;'> <tbody style='box-sizing: border-box;'> <tr style='box-sizing: border-box;'> <td style='box-sizing: border-box;'> <p style='box-sizing: border-box;color: #666666;font-size: 27px;font-weight: 700;font-family: "Lato", "Lucida Grande", "Lucida Sans Unicode", Tahoma, Sans-Serif;margin-bottom: 5%;'>Click the link below to verify your account!</p> </td> </tr> <tr style='box-sizing: border-box;'> <td style='box-sizing: border-box;'>" + "<a href =\"https://localhost:44346/Account/VerifyAccount?token=" + verificationToken + "&userid=" + userId + "\"><button style='box-sizing: border-box;background-color: #ffac35;color: white;padding: 10px 10px;border: none;cursor: pointer;opacity: 0.9;width: 220px;height: 100px;font-size: 25px;font-weight: 700;border-radius: 7px;-moz-transition: all 0.2s ease 0s;-o-transition: all 0.2s ease 0s;transition: all 0.2s ease 0s;margin: 0 auto;text-align: center;'>VERIFY NOW</button> </a>" + ""; string subject = "Verify your account"; MollShopContext.SendEmail(emailAddress, subject, messageBody); }
public async Task ConstructOrderVerificationMailAsync(string[] formVars) { //Get form information //Get labourer and service information List <OfferedLabourerService> purList = ParsePursToOls(); Tuple <List <OfferedLabourerService>, string[]> emailModel = Tuple.Create(purList, formVars); string messageBody = await this.RenderViewAsync("OrderConfirmMail", emailModel); MollShopContext.SendEmail(formVars[4], "Order confirmation", messageBody); }
//Requesting a password via email public IActionResult RequestPassword(string emailAddress) { string subject = "Password request"; tbl_userdata user = MollShopContext.FindUserByEmail(emailAddress); if (user.fld_userid == null) { //wrong emailaddress, reload the page and add the message "Email account not found" //For now, redirect to homepage return(RedirectToAction("HomePage", "Page")); } string firstName = user.fld_firstname; string messageBody = "<p>Hi " + firstName + ", You requested your password via email, so here it is: " + user.fld_password + "</p>"; MollShopContext.SendEmail(emailAddress, "Password request", messageBody); return(RedirectToAction("HomePage", "Page")); }