Hi friends,

I am using to read a inbox message from my asp.net code

The code is below. I got one exception every time i run the application.

I give username and password correctly.But i got exception again,

Exception is "Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. "


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Try

Dim TcpClient As New TcpClient

TcpClient.Connect("pop.gmail.com", 995)

Dim SslStream As System.Net.Security.SslStream = New SslStream(TcpClient.GetStream())

SslStream.AuthenticateAsClient("pop.gmail.com")

Dim sw As System.IO.StreamWriter = New StreamWriter(SslStream)

Dim reader As System.IO.StreamReader = New StreamReader(SslStream)

sw.WriteLine("USER [email protected]")

' sent to server

sw.Flush()

sw.WriteLine("PASS your_gmail_password")

sw.Flush()

' this will retrive your first email

sw.WriteLine("RETR 1")

sw.Flush()

' close the connection

sw.WriteLine("Quit ")

sw.Flush()

Dim str As String = String.Empty

Dim strTemp As String = String.Empty

While strTemp = reader.ReadLine()

If strTemp = "." Then

Exit While

End If

If strTemp.IndexOf("-ERR") <> -1 Then

Exit While

End If

str += strTemp

End While

Response.Write(str)

Response.Write("<BR>" + "Congratulation.. ....!!! You read your first gmail email ")

Catch ex As Exception

Response.Write(ex.Message)

End Try

End Sub

I hope urs reply.