aqtogh4hat
New Member
I have designed a simple contact form using Visual studio 2005,the page runs fine but when I hit send button I get error as showing below: error in " mailclient.Send(message).I would like to send it from my localhost that Im using with visual studio to my hotmail account but it's not sending email to my hotmail account the error is as follow.\[code\]A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 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: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respondSource Error: Line 24: Dim mailclient As SmtpClient = New SmtpClientLine 25: mailclient.Host = mailServerNameLine 26: mailclient.Send(message)Line 27: message.Dispose()Line 28: End Sub\[/code\]and this is my controller class :\[code\]Imports System.Net.MailPartial Class ContactUs Inherits System.Web.UI.Page Protected Sub textComments_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) End Sub Protected Sub textComments_TextChanged1(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtComments.TextChanged End Sub Protected Sub Send_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtSend.Click SendMail(txtEmail.Text, txtComments.Text) End Sub Private Sub SendMail(ByVal From As String, ByVal body As String) Dim mailServerName As String = "mail.hotmail.com" Dim message As MailMessage = New MailMessage(From, "[email protected]", "Feedback", body) Dim mailclient As SmtpClient = New SmtpClient mailclient.Host = mailServerName mailclient.Send(message) message.Dispose() End SubEnd Class\[/code\]SomeOne can pointed out where my mistake is, and also for the line "Dim mailServerName As String = "mail.hotmail.com" " I put " mail" because Don't know exactly how to get my localmail servername. Your help would be appreciated. Thanks in advance