Başlamadan önce: Bu bu sistem sadece gmail sunucusuyla çalışıyor.Program Windows formla yapıldığından gerekli toollar eklenmelidir. Kod: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace mailgonder { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private bool SendMail(string to, string subject, string message, string name) { try { System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage(); System.Net.NetworkCredential cred = new System.Net.NetworkCredential(cmbKullaniciAdi.Text.Trim(), txtSifre.Text.Trim()); mail.To.Add(to); mail.Subject = subject; mail.From = new System.Net.Mail.MailAddress(cmbKime.Text, name); mail.IsBodyHtml = true; mail.Body = message; System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.gmail.com"); smtp.UseDefaultCredentials = false; smtp.EnableSsl = true; smtp.Credentials = cred; smtp.Send(mail); } catch (Exception) { return false; } return true; } private void button1_Click(object sender, EventArgs e) { SendMail(cmbKime.Text, txtKonu.Text, txtMesaj.Text, cmbKimden.Text); } } }