Imports System. IO
Imports System. Net
Imports System. Net. Sockets
......
Private Function Connect (ByVal strServer As String, ByVal strUser As String, ByVal strPwd As String) As NetworkStream
Dim Sender As New TcpClient (strServer, 110)
Dim OutBytes As Byte ()
Dim input As String
Dim Ns As NetworkStream = Nothing
Try
Ns = Sender. GetStream ()
Dim sr As New StreamReader (Ns)
Input = "user" & strUser & vbCrLf
Outbytes = System. Text. Encoding. ASCII. GetBytes (input)
Ns. Write (OutBytes, 0, OutBytes. Length)
Console. WriteLine (sr. ReadLine ())
Input = "pass" & strPwd & vbCrLf
OutBytes = System. Text. Encoding. ASCII. GetBytes (input)
Ns. Write (OutBytes, 0, OutBytes. Length)
Console. WriteLine (sr. ReadLine ())
Console. writeLine ("========================================== ================================ ")
Return Ns
Catch ex As Exception
MsgBox ("unable to connect to server", MsgBoxStyle. Critical)
Return Ns
End Try
End Function
Private Function GetNumberOfNewMessages () As Integer
Dim OutBytes As Byte ()
Dim input As String
Dim strTemp As String
GetNumberOfNewMessages =-1
Try
Dim Ns As NetworkStream = Connect ("Enter the email server name here", "user name", "password ")
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.