public ActionResult Contacts(Concent cn) { if (ModelState.IsValid) { MailRepo.Add(cn); MailMessage msg = new MailMessage(); //yeni bir mail nesnesi Oluşturuldu. msg.IsBodyHtml = true; //mail içeriğinde html etiketleri kullanılsın mı? msg.To.Add("*****@*****.**"); //Kime mail gönderilecek. msg.From = new MailAddress(cn.EMail, "Kodyazan İletişim Sayfası", System.Text.Encoding.UTF8); //mail kimden geliyor, hangi ifade görünsün? msg.Subject = "Siteden gelen mesaj (İletişim formu)"; //mailin konusu msg.Body = "Ad:" + cn.Name + "<br>Email:" + cn.EMail + "Konu:" + cn.Phone + "<br>Mesajı:" + cn.Message; //mailin içeriği msg.IsBodyHtml = true; SmtpClient smp = new SmtpClient(); smp.Credentials = new NetworkCredential("*****@*****.**", "hakan123."); //mailin gönderileceği adres ve kullanıcı adı,şifresi smp.Port = 587; smp.Host = "smtp.gmail.com"; //gmail üzerinden gönderiliyor. smp.EnableSsl = true; smp.Send(msg); //msg isimli mail gönderiliyor. } ; return(View()); }
public ActionResult Mail() { var model = MailRepo.Menu(); return(View(model)); }