Beispiel #1
0
        public static bool DergoEmail()
        {
            MailMessage mail   = new MailMessage();
            SmtpClient  client = new SmtpClient();

            client.Port                  = 587;
            client.DeliveryMethod        = System.Net.Mail.SmtpDeliveryMethod.Network;
            client.UseDefaultCredentials = false;
            client.Host                  = "smtp.gmail.com";
            client.EnableSsl             = true;
            client.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "en!!9940808");
            client.Timeout               = 10000;
            mail.From = new MailAddress("*****@*****.**");
            mail.To.Add(new MailAddress(LexoSkedarin.LexoAdresen()));
            mail.Subject = LexoSkedarin.LexoSubjektin();
            mail.Body    = LexoSkedarin.LexoTrupin();
            RuajDb r = new RuajDb();

            try
            {
                client.Send(mail);
                r.Ruaj();
                RuajDb.cmd.Parameters.AddWithValue("@gjendja", RuajDb.Gjendja("Me sukses"));
                RuajDb.cmd.ExecuteNonQuery();
                return(true);
            }
            catch (Exception)
            {
                r.Ruaj();
                RuajDb.cmd.Parameters.AddWithValue("@gjendja", RuajDb.Gjendja("Gabim"));
                RuajDb.cmd.ExecuteNonQuery();

                return(false);
            }
        }
Beispiel #2
0
 public void Ruaj()
 {
     con = new SqlConnection(@"Data Source=localhost;Initial Catalog=shembull;Integrated Security=True");
     con.Open();
     cmd = new SqlCommand("insert into  [dbo].[email] (adresa,subjekti,trupi,gjendja) values(@adresa,@subjekti,@trupi,@gjendja)", con);
     cmd.Parameters.AddWithValue("@adresa", LexoSkedarin.LexoAdresen());
     cmd.Parameters.AddWithValue("@subjekti", LexoSkedarin.LexoSubjektin());
     cmd.Parameters.AddWithValue("@trupi", LexoSkedarin.LexoTrupin());
 }