- Mesajlar
- 494
Sitemden ziyaretçilerin mail göndermesini istiyorum.Bunun için Asp.net ile mail gönderme üzerine çalışıyorum.Smtp olarak gmaili kullandım.Bilgisaayarımdan program mail göndermiyor.Hosta attığım zaman mail gönderiyor.fakat mail gönderildikten sonra aşağıdaki hatayı veriyor.
Server Error in '/' Application.
--------------------------------------------------------------------------------
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
visual studioda yaptığım uygulamayı aynen serverın httpdocs klasörüne attım.Hostla ilgili yapmam gereken bi ayar mı var.bunu soracaktım.default.aspx kodlarım aşağıya yazdığım gibi:
Imports System.Net
Imports System.Mail
Partial Class _Default
Inherits System.Web.UI.Page
Dim client As New Mail.SmtpClient
Dim posta As New Mail.MailMessage
Protected Sub TextBox4_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged
posta.Subject = TextBox4.Text
End Sub
Protected Sub TextBox5_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged
posta.Body = TextBox5.Text
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
posta.To.Add(TextBox1.Text)
posta.From = New Mail.MailAddress(TextBox2.Text)
Dim yetki As New NetworkCredential(TextBox2.Text, TextBox3.Text)
client.Credentials = yetki
client.Host = "smtp.gmail.com"
client.EnableSsl = True
client.Send(posta)
MsgBox("mailiniz gönderildi.")
Catch ex As Exception
MsgBox("bir hata oluştu tekrar deneyiniz.")
End Try
End Sub
End Class
Server Error in '/' Application.
--------------------------------------------------------------------------------
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
visual studioda yaptığım uygulamayı aynen serverın httpdocs klasörüne attım.Hostla ilgili yapmam gereken bi ayar mı var.bunu soracaktım.default.aspx kodlarım aşağıya yazdığım gibi:
Imports System.Net
Imports System.Mail
Partial Class _Default
Inherits System.Web.UI.Page
Dim client As New Mail.SmtpClient
Dim posta As New Mail.MailMessage
Protected Sub TextBox4_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged
posta.Subject = TextBox4.Text
End Sub
Protected Sub TextBox5_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged
posta.Body = TextBox5.Text
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
posta.To.Add(TextBox1.Text)
posta.From = New Mail.MailAddress(TextBox2.Text)
Dim yetki As New NetworkCredential(TextBox2.Text, TextBox3.Text)
client.Credentials = yetki
client.Host = "smtp.gmail.com"
client.EnableSsl = True
client.Send(posta)
MsgBox("mailiniz gönderildi.")
Catch ex As Exception
MsgBox("bir hata oluştu tekrar deneyiniz.")
End Try
End Sub
End Class