private void button1_Click(object sender, EventArgs e) { try { Metoda metoda = new Metoda(); nazmaila = label1.Text; sifra = textBox1.Text; mailprim = comboBox1.Text; nasmaila = label3.Text; tekst = textBox3.Text; int p = 0, p1 = 0; if (metoda.ProvjeriLozinku(textBox1.Text)) { p = 1; } if (metoda.ProvjeriMail(comboBox1.Text)) { p1 = 1; } if (p1 == 1 && p == 1) { metoda.SaljiMail(nazmaila, sifra, mailprim, nasmaila, tekst); } else { MessageBox.Show("Nemogu poslati mail, provjerite lozinku i e-mail !"); } } catch (Exception) { MessageBox.Show("Nemogu poslati mail, provjerite lozinku i e-mail !"); } }