Click here to Skip to main content
14,325,129 members
Rate this:
Please Sign up or sign in to vote.
See more:
i have trying to on how to do on reseting password by email
however when i click on the button it prompt
"The remote name could not be resolved: '' at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint) at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message)"

in the lblMessage label so how should i solve this ?

'create your variables
        Dim strSubject As String = "Your Password Has Been Reset"
        Dim strFromEmail As String = txtEmail.Text

        Dim strFromName As String = "My Website Administrator"
        Dim strNewPassword As String = GeneratePassword().ToString()  'This is where you'd call the new password string.

            'create the new mail message[/color]
            Dim MailMsg As MailMessage = New MailMessage()

            'cretate the FROM[/color]
            MailMsg.From = New MailAddress(strFromEmail)

            'create the subject[/color]
            MailMsg.Subject = strSubject

            'We obviously need to create the TO - otherwise it goes nowhere.
            ' Dim 'assuming there was a form to fill out and they put the right email address in. As 

            MailMsg.IsBodyHtml = True 'I decided to make it html - so I could format the text.
            MailMsg.Body = "<h1>The following email was sent to you by " + strFromName + ".</h1><br />"
            MailMsg.Body += "<p>Apparently, you needed your password reset - So here it is: <br />"
            MailMsg.Body += "New Password " + strNewPassword + "<br />"
            'MailMsg.Body += "If you didn't request this, then - oops, you might wanna think about changing it, now. ""
            'MailMsg.Body += "<p>Click the following link to change your password:</p>"
            'MailMsg.Body += "<p></P>"

            'utilizing SMTP (simple mail transfer protocol)
            Dim smtp As SmtpClient = New SmtpClient()
            smtp.Host = "" 'if my domain had a way of sending out emails.
            'Dim 'send it As 

            lblMessage.Text = "Message Sent Successfully"  'tell the person that the email was sent.

        Catch ex As Exception
            lblMessage.Text = "Error: " + ex.ToString()  'or tell the person that they screwed up and it's all their fault.... or what the actual error was.
        End Try

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1


The smpt.Host should be like,

smtp.Host = "" // whatever the mail server for the hotmail

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100