Пример #1
0
        public void SendValiadationEmail(string emailAddress, string validationUrlFormat, DateTime dateTime, int id)
        {
            dateTime = DateTime.Now;
            Email email = new Email {
                Address = emailAddress, EmailHasValidated = dateTime, OwnerId = id
            };

            email.MakeValidationCode();
            _userRepoistory.Save(email);

            string      validationUrl = string.Format(validationUrlFormat, email.ValidationCode, email.id);
            MailMessage mail          = new MailMessage();

            mail.From = new MailAddress("*****@*****.**");
            mail.To.Add(emailAddress);
            mail.Subject = "一起帮注册验证";
            mail.Body    = validationUrl;

            SmtpClient SmtpServer = new SmtpClient();

            SmtpServer.Port        = 25;
            SmtpServer.Host        = "smtp.163.com";
            SmtpServer.Credentials = new System.Net.NetworkCredential("q123922261", "q199696");
            SmtpServer.EnableSsl   = false;

            SmtpServer.Send(mail);
        }
Пример #2
0
        public void Register(string username, string password)
        {
            MYUser user = new MYUser
            {
                Name     = username,
                Password = password
            };

            user.Register(user);
            _userRepoistory.Save(user);
        }