Making a POP3 Client
The next thing we want to do is to download a list of the messages on the server. To do this we use the STAT command. In the sample code you will notice that I have used a User Defined Type structure and an array to store each message in. You may come up with another way that is better or more suited to your needs, but for the moment, I will just present the UDT:
Type tMailItem From As String Subject As String DateSent As String Bytes As Long Body As String Loaded As Boolean Deleted As Boolean End Type
The names tell you quite basically what each one does. I would just like to point out that the last two properties, Loaded and Deleted play an important part in the sample project. The Loaded flag tells us if the message is currently loaded in the viewing window. The Deleted flag tells us if the message is to be deleted from the server when we disconnect. Any incorrect handling of the Deleted flag could cause serious problems in your application.
I hope that this article has given you enough understanding to be able to download the sample project (a fully functional POP client) and look through the code and know what's going on.
Download the code
Page 6 of 6