Click here to Skip to main content
15,888,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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: 'myemail@hotmail.com' 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 ?


VB
'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.

        Try
            '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.To.Add(txtEmail.Text)

            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>http://www.mywebsite.com/passwordChangeThing/Default.aspx</P>"

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

            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
Posted

1 solution

Hi,

The smpt.Host should be like,

C#
smtp.Host = "smtp.live.com" // whatever the mail server for the hotmail
 
Share this answer
 

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

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900