wodPop3 ActiveX Control - wodPop3 Object
    
 
Description

This is main wodPop3 object.


Object Model



Members
Methods
About Shows aboutbox.
Connect Connects to POP3 server.
Disconnect Disconnects from the server.
Reset Resets session on the server.

Properties
Authentication Read-write property Determines authentication type with the server.
Blocking Read-write property Determines if methods are blocking.
Certificate Read-write property Holds private certificate/private key information.
Hostname Read-write property Holds hostname of POP3 server.
LastError Read-only property Holds last error that occurred.
LastErrorText Read-only property Holds text representation of last error.
Login Read-write property Holds your login information.
Messages Read-only property Returns reference to collection of messages.
MyHostname Read-write property Holds hostname of local computer.
MyIP Read-write property Holds IP address of local computer.
Notification Read-write property Fast notifications interface.
Password Read-write property Holds your password on POP3 server.
Port Read-write property Holds port on POP3 server.
Security Read-write property Determines if SSL is used.
State Read-only property Holds current state.
StateText Read-only property Returns text representation of the state.
Timeout Read-write property Holds timeout value, in seconds.
Version Read-write property Holds version information.

Events
Connected Fires when wodPOP3 component connects to the server.
Disconnected Fires when wodPOP3 component disconnects from the server.
Done Fires when wodPOP3 component finishes execution of some method.
Progress Fires during message retrieval.
Received Fires when wodPOP3 component finishes receiving the message.
StateChange Fires when wodPOP3 component changes its state.
 
 
Remarks
Typically, when you want to download messages from the server, you can do it two ways:

1. Connect, grab all messages, disconnect, and then review what you got. In blocking mode, this is as easy as:

Dim WithEvents Pop3 As wodPop3Com
'........
Set Pop3 = New wodPop3Com
Pop3.HostName = "your.hostname.com"
Pop3.Login = "login"
Pop3.Password = "password"
Pop3.Blocking = True
Pop3.Connect
Pop3.Messages.GetAll
Pop3.Disconnect
Debug.Print Pop3.Messages.Count
MsgBox Pop3.Messages(0).Body
 

2. You can connect, and then check messages one-by-one to decide if you will download them or not. This is more common behavior, especially on slow connections:

Option Explicit
Dim WithEvents Pop3 As wodPop3Com
Dim Counter As Integer
Private Sub Form_Load()
      Set Pop3 = New wodPop3Com
      Pop3.HostName = "your.hostname.com"
      Pop3.Login = "login"
      Pop3.Password = "password"
      Counter = 0
      Pop3.Connect
End Sub

Private Sub Pop3_Connected()
      Debug.Print "CONNECTED"
      Debug.Print "Has " & Pop3.Messages.Count & " messages, download them all"
      ' go with download
      Pop3_Done 0, ""
End Sub

Private Sub Pop3_Disconnected(ByVal ErrorCode As Long, ByVal ErrorText As String)
      Debug.Print "DISCONNECTED " & ErrorText
End Sub

Private Sub Pop3_Done(ByVal ErrorCode As Long, ByVal ErrorText As String, HeadersOnly as Boolean)
      Debug.Print "DONE " & ErrorText
      If Counter < Pop3.Messages.Count Then
            Debug. Print "Downloading message " & Counter & ", expected size is " & Pop3.Messages(Counter).Size
            Pop3.Messages(Counter). Get
            Counter = Counter + 1
      Else
            Debug. Print "All done. Disconnecting..."
            Pop3.Disconnect
      End If
End Sub

Private Sub Pop3_Progress(ByVal Position As Long, ByVal Total As Long)
      Debug.Print "Progress " & Position & " / " & Total
End Sub

Private Sub Pop3_StateChange(ByVal OldState As WODPOP3COMLib.StatesEnum)
      Debug.Print "StateChange to " & Pop3.StateText
End Sub