示例#1
0
        private void button2_Click(object sender, EventArgs e)
        {
            us   u    = new us();
            rakt rakt = new rakt();

            if (u.belep(textBox1.Text, textBox2.Text) == 0)
            {
                rakt.Show();
            }
            if (u.belep(textBox1.Text, textBox2.Text) == 1)
            {
                pw.SetError(textBox2, "helytelen jelszó");
            }
            else
            {
                pw.Clear();

                pw.SetError(textBox2, "");
            }
            if (u.belep(textBox1.Text, textBox2.Text) == 2)
            {
                uname.SetError(textBox1, "nincs ilyen felhasználónév");
            }
            else
            {
                uname.Clear();
                uname.SetError(textBox1, "");
            }
        }
示例#2
0
        private void buttonSend_Click(object sender, EventArgs e)
        {
            us     u     = new us();
            string email = "";

            email = u.emailOfUser(textBox1.Text);
            MessageBox.Show(email);

            /*MailMessage mail = new MailMessage("*****@*****.**", email);
             * MessageBox.Show("Test");
             * SmtpClient client = new SmtpClient();
             * MessageBox.Show("Test2");
             * client.Port = 25;
             * MessageBox.Show("Test3");
             * client.DeliveryMethod = SmtpDeliveryMethod.Network;
             * MessageBox.Show("Test3");
             * client.UseDefaultCredentials = false;
             * MessageBox.Show("Test4");
             * client.Host = "smtp.gmail.com";
             * MessageBox.Show("Test5");
             * mail.Subject = "this is a test email.";
             * MessageBox.Show("Test6");
             * mail.Body = "this is my test email body";
             * MessageBox.Show("Test7");
             * try
             * {
             *  client.Send(mail);
             * }
             * catch (Exception x) { Debug.WriteLine(x.Message); }
             * MessageBox.Show("Test8");*/
            MessageBox.Show("Test");
            MailMessage objeto_mail = new MailMessage();

            MessageBox.Show("Test2");
            SmtpClient client = new SmtpClient();

            client.Port           = 587;
            client.Host           = "smtp.outlook.com";
            client.Timeout        = 10000;
            client.DeliveryMethod = SmtpDeliveryMethod.Network;

            client.EnableSsl = true;

            client.UseDefaultCredentials = false;
            client.Credentials           = new System.Net.NetworkCredential("*****@*****.**", mypw);
            objeto_mail.From             = new MailAddress("*****@*****.**");
            objeto_mail.To.Add(new MailAddress("*****@*****.**"));
            objeto_mail.Subject = "Password Recover";
            objeto_mail.Body    = "Message";
            MessageBox.Show("Test8");
            client.Send(objeto_mail);
        }