From Xojo Documentation
| This item was deprecated in version 2018r4.
Please use POP3SecureSocket as a replacement.
Used to retrieve and manage messages on a POP3 mail server.
If you use a constructor in a subclass of POP3Socket, you must call the Super class's constructor in your subclass's constructor. The subclass will not work unless this is done.
Specifications of POP3 (Post Office Protocol version 3) are provided in RFC 1939.
To access a POP3 server from web apps running on Xojo Cloud, you will first have to use the FirewallPort class to open the port used to connect to the POP3 server.
fwp.Open // This call is synchronous
If fwp.IsOpen() Then
// Do what you need to do
As any socket, the POP3 sockets work asynchronously, i.e. the methods trigger exchange of data from/to the POP3 server and results are provided through the available events. If an error occurred, it is sent through the ServerError event.
The following example is from the "Email Example" project. The project uses two windows. The "demoWindow" window is used to receive emails. The "sendDemoWindow" window uses the SMTPSocket to send emails.
DemoWindow contains fields for entering the server address, username, and password, a PushButton, and a ListBox for displaying the list of messages. A POP3Socket control, POP3Socket1, has been added to the window. The user clicks the “Connect” PushButton to connect to the mail server, receive email, and list the messages in a ListBox. Its Action event establishes a connection to a POP3 server. It gets the name of the server, username, and password from the contents of the TextFields, ServerFld, UserNameFld, and PasswordFld.
Socket1.address = NthField(ServerFld.Text, ":", 1)
Socket1.Port = Val(NthField(ServerFld.Text, ":", 2))
If Socket1.Port = 0 Then
Socket1.Port = 110
Socket1.Username = UsernameFld.Text
Socket1.Password = PasswordFld.Text
ProgressBar1.Maximum = 0
Me.Caption = "Disconnect"
Me.Caption = "Connect"
Dim s As String
// display the message
s = Email.bodyHTML
If s = "" Then
s = Email.BodyPlainText
BodyFld.Text = ReplaceAll(s, Chr(13) + Chr(10), Chr(13))
// headers received. populate the Listbox
ListBox1.Cell(ListBox1.LastIndex, 1) = Email.FromAddress
ListBox1.Cell(ListBox1.LastIndex, 2) = Str(ID)
If ID < MessageTotal Then // there are still messages left
Me.RetrieveLines(id + 1, 0) // get the next message headers
After populating the ListBox, it checks against the window property MessageTotal, which contains the result from a call to CountMessages, to see if there are any more message on the server. MessageTotal is assigned the value of the Count parameter in the MessageCount event.