VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



POP3 Mail Read

by Tair Abdurman (6 Submissions)
Category: Internet/HTML
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (39 Votes)

POP3 protocol client latest release. Usage and full source code.

Rate POP3 Mail Read

'WS_POP3_Conn is winsock component variable
'pop3 session state after send LIST command
'full source code and usage paper you can find at 
'http://www.tair.freeservers.com
Case 4
 WS_POP3_Conn.GetData inBuffer2, vbString
 inBuffer = inBuffer & inBuffer2
If def_mail = 0 Then
'Answer on LIST command
 If Right(inBuffer, 5) = CRLF_CRLF Then
 'OK LIST response terminated
  def_mail = def_mail + 1
  Tmp_log.Text = Tmp_log.Text & "Parsing List Response" & CRLF
  If Parse_LIST_Response(inBuffer) = 0 Then
   Tmp_log.Text = Tmp_log.Text & "FOUND: " & mail_count & " mail(s)" & CRLF
   outBuffer = "RETR " & def_mail & CRLF
   Tmp_log.Text = Tmp_log.Text & "RETR " & def_mail & " COMMAND SENT" & CRLF
   Cmd_First.Enabled = False
   Cmd_Prev.Enabled = False
   Cmd_Next.Enabled = False
   Cmd_Last.Enabled = False
   Cmd_GoTo.Enabled = False
  Else
   outBuffer = "QUIT" & CRLF
   Tmp_log.Text = Tmp_log.Text & "NO MAILS FOUND" & CRLF
   Tmp_log.Text = Tmp_log.Text & "QUIT COMMAND SENT" & CRLF
   Command_ID = 5
   Tmp_log.Text = Tmp_log.Text & "cid=5" & CRLF
  End If
  Tmp_log.Text = Tmp_log.Text & "ibuffer=" & inBuffer
  Tmp_log.Text = Tmp_log.Text & "obuffer=" & outBuffer
  inBuffer = ""
  WS_POP3_Conn.SendData outBuffer
  Tmp_log.SelStart = Len(Tmp_log.Text) - 1
  Tmp_log.Refresh
 'EOF OK LIST response terminated
 End If
'EOF Answer on LIST command
Else
 If def_mail < mail_count Then
'recive n mail
 If Right(inBuffer, 5) = CRLF_CRLF Then
 'OK n mail terminated
  zu = Parse_Mail(inBuffer, def_mail)
  def_mail = def_mail + 1
  outBuffer = "RETR " & def_mail & CRLF
 Tmp_log.Text = Tmp_log.Text & "RETR " & def_mail & " COMMAND SENT" & CRLF
  inBuffer = ""
  WS_POP3_Conn.SendData outBuffer
  Tmp_log.SelStart = Len(Tmp_log.Text) - 1
  Tmp_log.Refresh
  'ok n mail recived
  'EOF ok n mail recived
  'Else
  'fail n mail not recived
  'EOF fail n mail not recived
  'End If
 'EOF OK n mail terminated
 End If
'EOF recive n mail
 Else
'recive last mail
 If Right(inBuffer, 5) = CRLF_CRLF Then
 'OK last mail terminated
  'If Left(inBuffer, 1) = "+" Then
  'ok last mail recived no errors
  zu = Parse_Mail(inBuffer, def_mail)
  Tmp_log.Text = Tmp_log.Text & "cid=5" & CRLF
  Tmp_log.Text = Tmp_log.Text & "Get Last Mail" & CRLF
  Tmp_log.Text = Tmp_log.Text & "ibuffer=" & inBuffer
  Tmp_log.Text = Tmp_log.Text & "obuffer=" & outBuffer
  outBuffer = "QUIT" & CRLF
  Tmp_log.Text = Tmp_log.Text & "QUIT COMMAND SENT" & CRLF
  Command_ID = 5
  Tmp_log.Text = Tmp_log.Text & "cid=5" & CRLF
  inBuffer = ""
  If mail_count > 1 Then
   Cmd_First.Enabled = False
   Cmd_Prev.Enabled = False
   Cmd_Next.Enabled = True
   Cmd_Last.Enabled = True
   Cmd_GoTo.Enabled = True
  End If
  Lbl_Mail_Count.Caption = "of " & mail_count
  Lbl_Mail_Count.Refresh
  Load_Fields 1
  txt_Position.Text = "1"
  txt_Position.Refresh
  WS_POP3_Conn.SendData outBuffer
  Tmp_log.Text = Tmp_log.Text & "QUIT COMMAND SENT" & CRLF
  Tmp_log.SelStart = Len(Tmp_log.Text) - 1
  Tmp_log.Refresh
  'EOF ok last mail recived no errors
  'Else
  'last mail recived with errors
  ' MsgBox "last mail recived with errors."
  ' Command_ID = 5
  'EOF last mail recived with errors
  'End If
 'EOF OK last mail terminated
 End If
 'recive last mail
 End If
End If

Download this snippet    Add to My Saved Code

POP3 Mail Read Comments

No comments have been posted about POP3 Mail Read. Why not be the first to post a comment about POP3 Mail Read.

Post your comment

Subject:
Message:
0/1000 characters