Imports System.IO
Imports System.Net.Sockets
Imports System.Text
Imports System.Net.Security
Public Class Form1
Dim PopHost As String = "my mail server"
Dim UserName As String = "my user name"
Dim Password As String = "my password"
Dim PortNm As Integer = "110"
Dim POP3 As New TcpClient
Dim Read_Stream As StreamReader
Dim NetworkS_tream As NetworkStream
Dim m_sslStream As SslStream '<---this part needs changed
Dim server_Command As String
Dim Parts() As String
Dim m_buffer() As Byte
Dim StatResp As String
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
Me.Close()
End Sub
Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Label2.Parent = PictureBox1
Label2.BringToFront()
Label2.BackColor = Color.Transparent
Cursor = Cursors.WaitCursor
POP3.Connect(PopHost, Integer.Parse(PortNm))
Login()
Cursor = Cursors.Default
End Sub
Sub Login()
NetworkS_tream = POP3.GetStream()
m_sslStream = New SslStream(NetworkS_tream) '<-- and all this part with the m_sslStream stuff
m_sslStream.AuthenticateAsClient(PopHost)'<-- and all this part with the m_sslStream stuff
Read_Stream = New StreamReader(m_sslStream)'<-- and all this part with the m_sslStream stuff
ListBox1.Items.Add(Read_Stream.ReadLine())'<-- and all this part with the m_sslStream stuff
server_Command = "USER " + UserName + vbCrLf
m_buffer = System.Text.Encoding.ASCII.GetBytes(server_Command.ToCharArray())
m_sslStream.Write(m_buffer, 0, m_buffer.Length)'<--and all this part with the m_sslStream stuff
ListBox1.Items.Add(Read_Stream.ReadLine())
server_Command = "PASS " + Password + vbCrLf
m_buffer = System.Text.Encoding.ASCII.GetBytes(server_Command.ToCharArray())
m_sslStream.Write(m_buffer, 0, m_buffer.Length)'<--and all this part with the m_sslStream stuff
ListBox1.Items.Add(Read_Stream.ReadLine())
'Send STAT command to get information ie: number of mail and size
server_Command = "STAT " + vbCrLf
m_buffer = System.Text.Encoding.ASCII.GetBytes(server_Command.ToCharArray())
m_sslStream.Write(m_buffer, 0, m_buffer.Length)'<--and all this part with the m_sslStream stuff
ListBox1.Items.Add(Read_Stream.ReadLine())
StatResp = ListBox1.Items(3).ToString
'Get Messages count
Dim server_Stat(2) As String
server_Stat = StatResp.Split(" ")
Label2.Text = server_Stat(1)
End Sub
End Class
Using the code above fails because, well my coding sucks, and so does godaddy. That said I know the port 110 is not the SSL port and when I put the proper port there "995" it fails with a certificate error. Most of the code was written to connect to gmail, and well I want to connect to my godaddy pop3 server
What needs to be changed so it doesn't try to authenticate using SSL as the connection stream? I don't need or it seems can use the SSL because when I try I get this "The remote certificate is invalid according to the validation procedure." cry