using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Net.Mail; public class Mail { private string Host { get; set; } private int Port { get; set; } private string KullaniciAdi { get; set; } private string KullaniciSifre { get; set; } private string GonderenMail { get; set; } private string MailImza { get; set; } private bool SSL { get; set; } public Mail(string Host, int Port, string KullaniciAdi, string Sifre, string GonderenMail, string MailImza, bool SSL) { this.Host = Host; this.Port = Port; this.KullaniciAdi = KullaniciAdi; this.KullaniciSifre = Sifre; this.GonderenMail = GonderenMail; this.MailImza = MailImza; this.SSL = SSL; } public void Gonder(List adresler, string MailKonu, string MailIcerik) { SmtpClient mail = new SmtpClient(); mail.Host = Host; mail.Port = Port; mail.Credentials = new System.Net.NetworkCredential(KullaniciAdi, KullaniciSifre); mail.EnableSsl = SSL; MailMessage mesaj = new MailMessage(); mesaj.IsBodyHtml = true; mesaj.Priority = MailPriority.High; mesaj.From = new MailAddress(GonderenMail); foreach (string adres in adresler) { mesaj.To.Add(adres); } mesaj.Subject = MailKonu; mesaj.Body = MailIcerik + "


" + MailImza; mail.Send(mesaj); } public void Gonder(List adresler, string MailKonu, string MailIcerik, List dosyalar) { SmtpClient mail = new SmtpClient(); mail.Host = Host; mail.Port = Port; mail.Credentials = new System.Net.NetworkCredential(KullaniciAdi, KullaniciSifre); mail.EnableSsl = SSL; MailMessage mesaj = new MailMessage(); mesaj.IsBodyHtml = true; mesaj.Priority = MailPriority.High; mesaj.From = new MailAddress(GonderenMail); foreach (string adres in adresler) { mesaj.To.Add(adres); } foreach (Attachment dosya in dosyalar) { mesaj.Attachments.Add(dosya); } mesaj.Subject = MailKonu; mesaj.Body = MailIcerik + "


" + MailImza; mail.Send(mesaj); } }