Ejemplo n.º 1
0
        public async Task <bool> CreateActiveCodeAsync(string email)
        {
            string randomCode = _utils.CreateCode();
            var    smtpClient = new SmtpClient
            {
                Host                  = "smtp.gmail.com", // set your SMTP server name here
                Port                  = 587,              // Port
                EnableSsl             = true,
                DeliveryMethod        = System.Net.Mail.SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,
                Credentials           = new NetworkCredential("*****@*****.**", "899a1902f")
            };

            using (var message = new MailMessage("*****@*****.**", email)
            {
                Subject = "Your Active Code In Project Porfolio System:",
                Body = "Active code will Expires in 5 minutes: " + randomCode
            })
            {
                await smtpClient.SendMailAsync(message);
            }

            return(_accountRepository.CreateActiveCode(email, randomCode));
        }