dcsimg
Results 1 to 7 of 7

Thread: POP3 Implementation problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Location
    Tupi, Southern part of the Philippines
    Posts
    6

    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 = "username@gmail.com"
    _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...

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,029

    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

  3. #3
    Frenzied Member Lightning's Avatar
    Join Date
    Oct 2002
    Location
    Eygelshoven
    Posts
    1,611

    Re: POP3 Implementation problem

    Maybe it is the encoding that is different
    VB6 & C# (WCF LINQ) mostly


    If you need help with a WPF/WCF question post in the NEW WPF & WCF forum and we will try help the best we can

    My site

    My blog, couding troubles and solutions

    Free online tools

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Location
    Tupi, Southern part of the Philippines
    Posts
    6

    Re: POP3 Implementation problem

    Thanks for the move... I'm sorry for posting at the wrong forum...

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Location
    Tupi, Southern part of the Philippines
    Posts
    6

    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?

  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    32,381

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  7. #7
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,242

    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
  •  



Featured


Click Here to Expand Forum to Full Width