Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi, I'm Eelco and basicly new to visual basic.

 

I want to create an pop3 connection to receive email. I'm that far that my application will connect to my pop3 account. But then what, how can i recieve what the pop3 does or say,

i.e. when i'm connecting with USER user.(myname) pass.(mypass) and everything is ok. Then pop3 will send +OK back, how can I collect that within vb.net?

 

I thirst checked this out with TELNET and there I recieve +ok .

 

Hope you guys can help me with this.

 

 

 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      
       Dim client As New TcpClient
       client.Connect("Pop3.whatever.com", 110)

       If client.Connected = True Then

           Dim stream As NetworkStream = client.GetStream()
           Dim data As Byte() = System.Text.Encoding.ASCII.GetBytes("USER user.(myusername) pass.(mypassword)")

           stream.Write(data, 0, data.Length)



           MessageBox.Show(" Connected to  " & client.ToString)
       End If
   End Sub

 

 

Edit: 21:01

 

Sorry I was so eager to set my thread that it is in the wrong category, sorry for that.

Posted

Thnx.

 

But I figured it out, sort of.

 

This is what i'm using now.

 
Sub Connect()
           Dim message As String = String.Empty
           Dim pop3 As New TcpClient
           Dim data As [byte]() = System.Text.Encoding.ASCII.GetBytes(Message)

           Dim response As String = String.Empty
         

           Try
               pop3.Connect(pop3_setting, 110)
               Dim stream As NetworkStream = pop3.GetStream()
               data = New [byte](256) {}
               Dim bytes As Int32 = stream.Read(data, 0, data.Length)
               response = System.Text.Encoding.ASCII.GetString(data, 0, bytes)
               Form1.TextBox4.AppendText(response)
           Catch ex As Exception

           End Try

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...