Exemple #1
0
        public string ForgotPasswordSendEmail(ForgottenPasswordEmailTokenAddRequest model)
        {

            SecurityTokenService sts = new SecurityTokenService(_dataProvider);
            SecurityTokenAddRequest star = new SecurityTokenAddRequest()
            {
                TokenTypeId = 2,
                UserEmail = model.Email
            };
            System.Guid tokenGuid = sts.Insert(star);

            var source = "http://sawubona.dev/";
            var message =
                 "<body style='margin: 0; padding: 0; background:#ccc;'><table cellpadding=0 cellspacing=0 style='width: 100%;'><tr><td style='padding: 12px 2%;'><table cellpadding=0 cellspacing=0 style='margin:auto; background: #fff; width: 96%;'><tr><td style='padding: 12px 2%;'><div><h1 style='color:white;background-color:#1E90FF;'>Youth Mentoring Connection</h1></div > <div><h2 style='margin-top: 0;'>Password Reset</h2><p>To reset your password please click the link below:<br/></br> <span style='text-align:center; margin:0;'><a href="
                 + source + "forgottenPasswords?guid="
                 + tokenGuid + "/" + model.Email + ">Click Here To Reset Password</a></p><p>...</p></div><div><h4 style='margin-top: 0;'>Sawubona!</h4><p></p></div><div style='border-top: solid 1px #ccc;'><p></p></div></td ></tr ></table ></td ></tr ></table ></body >";

            ConfirmationEmailService ces = new ConfirmationEmailService();
            ConfirmationEmailRequest cer = new ConfirmationEmailRequest()
            {
                From = "*****@*****.**",
                To = model.Email,
                Subject = "YMC Confirmation",
                Body = message
            };
            Task<bool> email = ces.Execute(cer);

            return model.Email;
        }
Exemple #2
0
        private bool SendEmailConfirmationEmail(string email)
        {
            //1) creating token
            SecurityTokenService sts = new SecurityTokenService(_dataProvider);
            SecurityTokenAddRequest star = new SecurityTokenAddRequest()
            {
                TokenTypeId = 1,
                UserEmail = email
            };
            System.Guid tokenGuid = sts.Insert(star);
            //2) emailing confirmation
            var source = SiteConfig.BaseUrl;
            var message =
                 "<body style='margin: 0; padding: 0; background:#ccc;'><table cellpadding=0 cellspacing=0 style='width: 100%;'><tr><td style='padding: 12px 2%;'><table cellpadding=0 cellspacing=0 style='margin:auto; background: #fff; width: 96%;'><tr><td style='padding: 12px 2%;'><div><h1 style='color:white;background-color:#1E90FF;'>Personality App</h1></div > <div><h2 style='margin-top: 0;'>Congratulations</h2><p>You've successfully registered. Please confirm your email with the Personality App.To confirm your email click the link below:<br/></br> <span style='text-align:center; margin:0;'><a href="
                 + source + "/confirmationPages?guid="
                 + tokenGuid + ">Click Here To Confirm Email</a></p><p>...</p></div><div><h4 style='margin-top: 0;'>Sawubona!</h4><p></p></div><div style='border-top: solid 1px #ccc;'><p></p></div></td ></tr ></table ></td ></tr ></table ></body >";

            ConfirmationEmailService ces = new ConfirmationEmailService();
            ConfirmationEmailRequest cer = new ConfirmationEmailRequest()
            {
                From = SiteConfig.SiteAdminEmailAddress,
                To = email,
                Subject = "DJ MESSAGE",
                Body = message
            };
            Task<bool> success =  ces.Execute(cer);
            while (success == null)
            {
                return false;
            }
            return true;
        }