hey all, please h-e-l-p!!!
i am working on a new development for my comapny.
the main goal for now is to be able to get access to our support mail which is
Gmail. I am developing the code in vb.net after a bit of research on the web.
very important: when i am trying to access the email, i do that with the next defintions:
1. gmail server address: "pop.gmail.com"
2. user: xxxx@gmail.com
3. password: xxxxxxxx
4. port: 587
and now for the problem:
this Err appears during the connection:
"502 5.5.1 Unrecognized command. es9sm8530250wjd.1 - gsmtp"
i am digging this up for days and still nothing. please please help!!!!
I am attaching the relevent code here>>>
thank you very much,
oron.
-------------------------------------------------------------------------------------------
Imports System
Imports System.Net.Mail
Imports System.Net.Sockets
Imports System.Net.Mail.SmtpClient
Imports System.Text
Imports System.IO
Module POP3Message1
Dim Server As TcpClient
Dim NetStrm As NetworkStream
Dim RdStrm As StreamReader
Public Function connect() As String
Dim POP3Account As String
POP3Account = "pop.gmail.com"
Try
Server = New TcpClient(POP3Account.Trim, 587)
NetStrm = Server.GetStream
RdStrm = New StreamReader(Server.GetStream)
Catch exc As Exception
MsgBox(exc.Message)
Exit Function
End Try
Dim user As String
user = "xxxxxx@gmail.com"
Dim data As String = "USER " + user.Trim + vbCrLf
Dim szData() As Byte = System.Text.Encoding.ASCII.GetBytes(data.ToCharArray())
NetStrm.Write(szData, 0, szData.Length)
Dim POPResponse As String
POPResponse = RdStrm.ReadLine
If POPResponse.Substring(0, 4) = "-ERR" Then
MsgBox("Invalid user Name")
Return -1
End If
Dim password As String
password = "xxxxxx"
data = "PASS " & password & vbCrLf
szData = System.Text.Encoding.ASCII.GetBytes(data.ToCharArray())
NetStrm.Write(szData, 0, szData.Length)
POPResponse = RdStrm.ReadLine
If POPResponse.Substring(0, 4) = "-ERR" Then
MsgBox("Invalid Passwprd")
Return (-1)
End If
data = "STAT" + vbCrLf
szData = System.Text.Encoding.ASCII.GetBytes(data.ToCharArray())
NetStrm.Write(szData, 0, szData.Length)
POPResponse = RdStrm.ReadLine
If POPResponse.Substring(0, 4) = "-ERR" Then
MsgBox("could not log your in")
Return -1
End If
data = "Stat" + vbCrLf
szData = System.Text.Encoding.ASCII.GetBytes(data.ToCharArray())
NetStrm.Write(szData, 0, szData.Length)
POPResponse = RdStrm.ReadLine
If POPResponse.Substring(0, 4) = "-ERR" Then
MsgBox("could not log your in")
Return -1
End If
Dim parts() As String
parts = POPResponse.Split(" ")
Dim messages As Integer, totsize As Integer
'messages = parts(1)
messages = CInt(parts(1))
'messages = parts(1).ToString()
Return messages
End Function