コード例 #1
0
        public void TestNewMailAllTemplates()
        {
            Customer testCust = new Customer();
            testCust.FirstName = "Test";
            testCust.LastName = "Customer";
            testCust.EmailAddress = "*****@*****.**";

            Booking booking = new Booking();
            booking.StartDate = new DateTime(2014, 01, 04);
            booking.EndDate = new DateTime(2014, 01, 10);
            booking.NumberOfNights = 5;
            booking.PropertyID = 220;
            booking.BookingID = 513;


            BookingExtraSelection bes = new BookingExtraSelection();
            bes.ExtraRentalDate = new DateTime(2014, 01, 04);
            bes.ExtraReturnDate = new DateTime(2014, 01, 09);
            bes.BookingExtraID = 1;
            bes.BookingExtraSelectionID = 1; //primary key





            EmailController ec = new EmailController();
            /*var ok = ec.SendEmailToCustomer(testCust, , booking, bes);
            ok = ec.SendEmailToCustomer(testCust, EmailOutType.EmailOutEmailType.BookingConfirm, booking);
            ok = ec.SendEmailToCustomer(testCust, EmailOutType.EmailOutEmailType.BookingExtraSelectionConfirm, null, bes);*/




        }
コード例 #2
0
        public ActionResult ForgotPassword(FormCollection userForm)
        {

            string resetURL = Url.Action("ResetPassword", "Account", new { }, Request.Url.Scheme);


            
            var userstring = userForm["Email"];
            //try get the username
            var user = userContext.UserProfiles.Where(x => x.UserName.ToLower().Trim().Equals(userstring.ToLower().Trim())).FirstOrDefault();

            if (user != null)
            {
                //if exists, generate the token
                var token = WebSecurity.GeneratePasswordResetToken(user.UserName);

                //generate an email with the link
                var emailService = new EmailController();
                var email = emailService.CreateForgottenPasswordEmailTemplate(resetURL, user.UserName, token);

                var emailSent = email.SendEmail();

                ViewBag.Message = "A password reset has been sent, please check your email and click the link enclosed.";
                return View("PasswordResetSent");

            }


            ViewBag.Message = "Sorry we couldn't find that email address in the system. Please double check the email address you entered.";
            return View("PasswordResetSent");

        }