Bir sitenin iletişim sayfasında sorun
9
●883
- 10-09-2013, 09:26:23İletişim modülün yada mail bilgilerin yanlış olabilir.
Şu kodları dene ve tüm bilgilerinin doğru olduğundan emin ol.
DataTable dt = ado.makeDataTable("SELECT mailFrom,mailHost,mailPort,mailPassword,mailUserName FROM ayarlar", ado.cn); string smtpServer = dt.Rows[0]["mailHost"].ToString(); string smtpKulAdi = dt.Rows[0]["mailUserName"].ToString(); string smtpSifre = dt.Rows[0]["mailPassword"].ToString(); string gidecekMail = kime; string mailKonu = konu; int smtpPort = Convert.ToInt32(dt.Rows[0]["mailPort"]); bool smtpEnableSSL = false; try { SmtpClient sc = new SmtpClient(smtpServer); sc.Credentials = new NetworkCredential(smtpKulAdi, smtpSifre); sc.EnableSsl = smtpEnableSSL; sc.Port = smtpPort; MailMessage mail = new MailMessage(); mail.From = new MailAddress(smtpKulAdi, mailKonu); mail.To.Add(gidecekMail); mail.Subject = altKonu; mail.IsBodyHtml = true; mail.Body = icerik; sc.Send(mail); } catch (SmtpException ex) { HttpContext.Current.Response.Write("Mail Gönderme Hatasi <br>" + ex.Message); }