MailMessage Posta = new MailMessage();
Posta.From = new MailAddress("myname@gmail.com","My name");
//
Posta.To.Add("deneme1@gmail.com");
Posta.To.Add("deneme2@gmail.com");
// Posta.Attachments.Add(new Attachment(@"C:\deneme.txt"));
string konu = "konu";
Posta.Subject = konu;
//
string icerik = "içerik";
Posta.Body = icerik;
SmtpClient smtp = new SmtpClient();
smtp.Credentials = new System.Net.NetworkCredential("myname@gmail.com", "sifre");
smtp.Port = 587;
smtp.Host = "mail.gmail.com";
//smtp.EnableSsl = true;
object userState = ePosta;
bool kontrol = true;
try
{
smtp.SendAsync(Posta, (object)ePosta);
}
catch (SmtpException ex)
{
kontrol = false;
System.Windows.Forms.MessageBox.Show(ex.Message, "Mail Gönderme Hatasi");
}
MessageBox.Show("mail gonderildi");