private void button1_Click(object sender, EventArgs e)
{
MailMessage mail=new MailMessage();
mail.From = new MailAddress(textBox1.Text);
mail.To.Add("burakbaloglu1007@gmail.com");
mail.Subject = textBox2.Text;
mail.Body = textBox3.Text;
SmtpClient smtp=new SmtpClient();
smtp.Credentials = new System.Net.NetworkCredential("mail","sifre");
smtp.Port = 587;
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
object userState = mail;
bool kontrol = true;
try
{
smtp.SendAsync(mail, (object)mail);
}
catch (SmtpException ex)
{
kontrol = false;
System.Windows.Forms.MessageBox.Show(ex.Message, "Mail Gönderilemedi");
}
return kontrol;
}