POP3 Implementation problem
Ok so I tried the POP3 Implementation code to retrieve e-mail from Gmail. I tried the code I got from a link which was suggested from another thread. I'm supposed to receive responses like +OK or -Err but the problem is this is there's this odd characters that shows up in my MsgBox.
This is my code:
Dim _server As TcpClient
Dim _netstream As NetworkStream
Dim _stmreader As StreamReader
Dim _senddata() As Byte
Dim _ssl As Net.Security.SslStream
Dim _user, _password As String
Try
_server = New TcpClient("pop.gmail.com", 995)
_netstream = _server.GetStream
_ssl = New Net.Security.SslStream(_server.GetStream())
DirectCast(_ssl, Net.Security.SslStream).AuthenticateAsClient("pop.gmail.com")
_stmreader = New StreamReader(_server.GetStream)
Catch _ex As Exception
MsgBox(_ex.Message)
Exit Sub
End Try
_user = "[email protected]"
_password = "password"
_senddata = System.Text.Encoding.ASCII.GetBytes(("USER" + _user.Trim + vbCrLf).ToCharArray())
_netstream.Write(_senddata, 0, _senddata.Length)
_senddata = System.Text.Encoding.ASCII.GetBytes(("PASS" + _password.Trim + vbCrLf).ToCharArray())
_netstream.Write(_senddata, 0, _senddata.Length)
_senddata = System.Text.Encoding.ASCII.GetBytes(("STAT" + vbCrLf).ToCharArray())
_netstream.Write(_senddata, 0, _senddata.Length)
MsgBox(_stmreader.ReadLine)
Please help me, I don't know where I got the code wrong...
Re: POP3 Implementation problem
Thread moved from the 'CodeBank VB.Net' forum (which is for you to post working code examples, not questions) to the 'VB.Net' forum
Re: POP3 Implementation problem
Maybe it is the encoding that is different
Re: POP3 Implementation problem
Thanks for the move... I'm sorry for posting at the wrong forum...
Re: POP3 Implementation problem
Encoding? I'm sorry but I'm new to this... are you saying that there's something wrong with the "System.Text.Encoding" code? So what am I suppose to change?
Re: POP3 Implementation problem
"Odd character" ??? as opposed to the "Even character" ??? since you didn't provide an example, we're just shooting in the dark... there could be a couple of reasons ... one of which is the encoding... the other is the font of the text box... meanwhile there is a third reason not related to the other two...
-tg
Re: POP3 Implementation problem
I would be amazed if ASCII encoding was required here. I've programmed for GMail a few times and never used anything other than default encoding.