Arama butonu
Bu konudaki kullanıcılar: 1 misafir
0
Cevap
563
Tıklama
0
Öne Çıkarma
mvc contact form acil yardım
E
7 yıl
Teğmen
Konu Sahibi

MErhabalar,

mvc asp.net ile yaptığım sitede contact form ekledim. gmail smtp ayarlarını girdim. lokalde mail geliyor ama server a yükleyince gelmiyor. internette godaddy gmail smtp i engellediğini söylüyorlar. bunu nasıl aşabilirim ya da başka nereden ekleyebilirim? Yardımcı olursanız çok sevinirim

Aldığım hata bu:

An attempt was made to access a socket in a way forbidden by its access permissions 74.125.192.109:587
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions 74.125.192.109:587

Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Kodlar:

[HttpPost]
public ActionResult Iletisim(FormModel model)
{
MailMessage _mm = new MailMessage();



_mm.SubjectEncoding = Encoding.Default;
_mm.Subject = model.AdiSoyadi;
_mm.BodyEncoding = Encoding.Default;
_mm.Body = model.Mesaj;

_mm.From = new MailAddress(ConfigurationManager.AppSettings["emailAccount"]);
_mm.To.Add("mil@gmail.com");


SmtpClient _smtpClient = new SmtpClient();
_smtpClient.Host = ConfigurationManager.AppSettings["emailHost"];
_smtpClient.Port = int.Parse(ConfigurationManager.AppSettings["emailPort"]);
_smtpClient.Credentials = new NetworkCredential(ConfigurationManager.AppSettings["emailAccount"], ConfigurationManager.AppSettings["emailPassword"]);
_smtpClient.EnableSsl = bool.Parse(ConfigurationManager.AppSettings["emailSLLEnable"]);

_smtpClient.Send(_mm);

TempData["Basarili"] = " Teşekürler en kısa zamanda tafarınıza dönüş yapılacaktır.";

return RedirectToAction("Iletisim");



}



@using (Html.BeginForm("Iletisim", "ContactUs", FormMethod.Post, new { @class = "well form-horizontal" }))
{
<fieldset>
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<!-- Form Name -->
<legend class="col-form-label-lg">İletişim Formu!</legend>
<!-- Text input-->
<div class="form-group">
<label class="col-6 col-form-label">Adı Soyadı :</label>
<div class="col-6 col-form-label">
<div class="input-group">
<span class="text-center"><i class="fa fa-user fa-2x"></i></span>
@Html.TextBoxFor(model => model.AdiSoyadi, new { @class = "form-control", placeholder = "Adınız Soyadınız" })
</div>
@Html.ValidationMessageFor(model => model.AdiSoyadi, "", new { @class = "text-danger" })
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-6 col-form-label">E-Posta :</label>
<div class="col-6 col-form-label">
<div class="input-group">
<span class="text-center"><i class="fa fa-envelope fa-2x"></i></span>
@Html.TextBoxFor(model => model.Email, new { @class = "form-control", placeholder = "Email Adresiniz" })
</div>
@Html.ValidationMessageFor(model => model.Email, "", new { @class = "text-danger" })
</div>
</div>
<!-- Text area -->
<div class="form-group">
<label class="col-md-6 col-form-label">Mesajınız :</label>
<div class="col-md-6 col-form-label">
<div class="input-group">
<span class="text-center"><i class="fa fa-pencil-square-o fa-2x"></i></span>
@Html.TextAreaFor(model => model.Mesaj, new { @class = "form-control", placeholder = "Mesajınız " })

</div>
@Html.ValidationMessageFor(model => model.Mesaj, "", new { @class = "text-danger" })
</div>
</div>
@if (TempData["Basarili"] != null)
{
<!-- Success message -->
<div class="alert gonder" role="alert" id="success_message">
Gönderildi <span class="fa fa-thumbs-o-up fa-2x fa-fw"></span>@TempData["Basarili"]
</div>
}
<!-- Button -->
<div class="form-group">
<label class="col-md-6 col-form-label"></label>
<div class="col-md-6">
<button type="submit" class="btn gonder">Gönder <span class="fa fa-send-o fa-2x fa-fw"></span></button>
</div>
</div>
</fieldset>
}

DH forumlarında vakit geçirmekten keyif alıyor gibisin ancak giriş yapmadığını görüyoruz.

Üye olduğunda özel mesaj gönderebilir, beğendiğin konuları favorilerine ekleyip takibe alabilir ve daha önce gezdiğin konulara hızlıca erişebilirsin.

Üye Ol Şimdi Değil



DH Mobil uygulaması ile devam edin. Mobil tarayıcınız ile mümkün olanların yanı sıra, birçok yeni ve faydalı özelliğe erişin. Gizle ve güncelleme çıkana kadar tekrar gösterme.