|
-
Mar 2nd, 2012, 03:19 AM
#1
Thread Starter
New Member
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...
-
Mar 3rd, 2012, 09:25 AM
#2
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
-
Mar 3rd, 2012, 04:07 PM
#3
Re: POP3 Implementation problem
Maybe it is the encoding that is different
-
Mar 4th, 2012, 06:56 PM
#4
Thread Starter
New Member
Re: POP3 Implementation problem
Thanks for the move... I'm sorry for posting at the wrong forum...
-
Mar 4th, 2012, 06:58 PM
#5
Thread Starter
New Member
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?
-
Jan 9th, 2013, 05:26 PM
#6
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
-
Jan 9th, 2013, 05:37 PM
#7
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.
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|