Beispiel #1
0
        //SendMail(user.Id, "Reset Password", "Please reset your password by clicking <a href=\"" + callbackUrl + "\">here</a>");
        public void SendMail(string userId, string subject, string body)
        {
            InitNonExistingRepo();
            try
            {
                string userEmail = repo.ReadGebruiker(userId).Email;

                MailMessage mail       = new MailMessage();
                SmtpClient  SmtpServer = new SmtpClient("smtp.gmail.com");

                mail.From = new MailAddress("*****@*****.**");
                mail.To.Add(userEmail);
                mail.Subject    = subject;
                mail.Body       = body;
                mail.IsBodyHtml = true;

                SmtpServer.Port        = 587;
                SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "integratieproject");
                SmtpServer.EnableSsl   = true;

                SmtpServer.Send(mail);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Mail did not send" + ex);
            }
        }
 public Gebruiker GetGebruiker(int id)
 {
     return(repo.ReadGebruiker(id));
 }