public bool SendEmail(MailView detail) { bool sonuc = false; using (MailMessage mail = new MailMessage()) { string bodyx = "Gönderen :" + detail.name + "<br /> Telefon :" + detail.phone + " <br /> E-Posta :" + detail.email + "<br /> Mesaj içerik:" + detail.body; mail.From = new MailAddress("*****@*****.**", "Site Mesajı"); mail.To.Add("*****@*****.**"); mail.Subject = detail.name + " Adlı kişiden yeni mesaj bildirimi"; mail.Body = bodyx; mail.IsBodyHtml = true; using (SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587)) { try { smtp.Credentials = new NetworkCredential("*****@*****.**", "copypaste12345"); smtp.EnableSsl = true; smtp.Send(mail); sonuc = true; } catch (Exception ex) { sonuc = false; } } } return(sonuc); }
public bool SendMailNt(MailView detail) { string baslik = "Gönderen :" + detail.name + "<br /> Telefon :" + detail.phone + " <br /> E-Posta :" + detail.email; bool sonuc = false; MailMessage mm = new MailMessage(); mm.To.Add(new MailAddress("*****@*****.**", "Yeni Web Bildirim Mesajı")); mm.From = new MailAddress("*****@*****.**"); mm.Sender = new MailAddress("*****@*****.**", "Yeni Web Bildirim Mesajı"); mm.Subject = baslik; mm.Body = detail.body; mm.IsBodyHtml = true; mm.Priority = MailPriority.High; // Set Priority to sending mail SmtpClient smtCliend = new SmtpClient(); smtCliend.Host = "mail.teknoportsoft.com"; smtCliend.Port = 587; // SMTP port no smtCliend.Credentials = new NetworkCredential("*****@*****.**", "PDha45M4"); smtCliend.DeliveryMethod = SmtpDeliveryMethod.Network; try { smtCliend.Send(mm); sonuc = true; } catch (Exception ex) { sonuc = false; } return(sonuc); }