private void slanjeMaila(string kome, string tekst)
 {
     try {
         DAL_DAO.DAL d = DAL_DAO.DAL.Instanca;
         d.kreirajKonekciju();
         DAL_DAO.DAL.AdminDAO da = d.getDAO.getAdminDAO();
         string mail             = da.dajAdminovMail();
         string pass             = da.dajAdminovPass();
         d.terminirajKonekciju();
         SmtpClient client = new SmtpClient();
         client.Port                  = 587;
         client.Host                  = "smtp.gmail.com";
         client.EnableSsl             = true;
         client.Timeout               = 10000;
         client.DeliveryMethod        = SmtpDeliveryMethod.Network;
         client.UseDefaultCredentials = false;
         client.Credentials           = new System.Net.NetworkCredential(mail, pass);
         MailMessage mm = new MailMessage(mail, kome, "Izvještaj - Gola Ada", tekst);
         mm.BodyEncoding = UTF8Encoding.UTF8;
         mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
         client.Send(mm);
         System.Windows.MessageBox.Show("Mail je poslat!");
     } catch (Exception ex) {
         System.Windows.MessageBox.Show(ex.Message, "Problem kod slanja maila");
     }
 }
Exemple #2
0
 private void btnPotrdi_Click(object sender, RoutedEventArgs e)
 {
     try {
         DAL_DAO.DAL d = DAL_DAO.DAL.Instanca;
         d.kreirajKonekciju();
         DAL_DAO.DAL.AdminDAO ad = d.getDAO.getAdminDAO();
         mail     = ad.dajAdminovMail();
         pass     = ad.dajAdminovPass();
         noviPass = generirajPassword();
         d.terminirajKonekciju();
         if (typeof(Admin) == user.GetType())
         {
             potvrdiAdmina();
         }
         else
         {
             potvrdiUsera();
         }
     } catch (Exception) {
         throw;
     }
 }