Beispiel #1
0
        public static void GuiEmail(string Title, string ToEmail, string Content)
        {
            var db         = new KhareedoEntities();
            var inforEmail = db.Mails.FirstOrDefault(c => c.Status == true);
            // goi email
            MailMessage mail = new MailMessage();

            mail.To.Add(ToEmail);                    // Địa chỉ nhận
            mail.From    = new MailAddress(ToEmail); // Địa chửi gửi
            mail.Subject = Title;                    // tiêu đề gửi
            mail.Body    = Content;                  // Nội dung

            mail.IsBodyHtml = true;
            SmtpClient smtp = new SmtpClient();

            smtp.Host = "smtp.gmail.com"; // host gửi của Gmail
            smtp.Port = 587;              //port của Gmail
            smtp.UseDefaultCredentials = false;
            smtp.Credentials           = new System.Net.NetworkCredential
                                             (inforEmail.Email, inforEmail.Pass); //Tài khoản password người gửi
            smtp.EnableSsl = true;                                                //kích hoạt giao tiếp an toàn SSL
            smtp.Send(mail);                                                      //Gửi mail đi
        }
Beispiel #2
0
 public GenericRepository(KhareedoEntities _context)
 {
     this._context = _context;
     table         = _context.Set <T>();
 }
Beispiel #3
0
 public GenericRepository()
 {
     this._context = new KhareedoEntities();
     table         = _context.Set <T>();
 }