FreePOP ActiveX control
Version 2.0.3
March 15, 1998
Description
FreePOP is an ActiveX control that allows read/write access to a POP3 mailbox and the messages in the mailbox. This ActiveX control was developed with Microsoft Visual Basic 5.0-SP3.
Possible uses
Why it was created?
Why Free?
Limitations
Notes
Legal stuff
Support
Contact information
Please use the email address FreePOP@usa.net for any communications regarding the FreePOP ActiveX control. The homepage for the FreePOP ActiveX control is: http://www.geocities.com/SiliconValley/Lab/7135
Futures
Author information
Glenn Harm is employed by a large computer company as a computer consultant. His current expertise is working on large scale Microsoft Exchange Server deployments. He also enjoys all possible ways to keep up with the changing face of computer technology and spends way too much time with his computer and the Internet.
Donations
If you find this control so useful and wish to support it financially, please send me an email and I'll send you a snail mail address to use for this purpose.
How can you help?
FreePOP ActiveX control documentation
Installation
FreePOP Methods
Connect - This method initiates a connection to a POP3 server. It connects, sends the username and password and collects some information about the mailbox. See the Properties section for further information.
Example: FreePOP1.Connect
Disconnect - This method closes the connection previously made to a POP3 server.
Example: FreePOP1.Disconnect
SetCurrentMsg - This method selects a specific message on the POP3 server. The message headers are retrieved and put into various properties. See the Properties section for further information.
Example: FreePOP1.SetCurrentMsg 1
RetrieveCurrentMsg - This method retrieves the currently selected message from the POP3 server. It "reads" it only--it does NOT remove it from the POP3 server. See the Properties section for further information.
Example: FreePOP1.RetrieveCurrentMsg
DeleteCurrentMsg - This method marks the currently selected message for deletion on the POP3 server.
Example: FreePOP1.DeleteCurrentMsg
ResetDeletedMsgs - This method unmarks any messages that have been previously marked for deletion in the current POP3 session.
Example: FreePOP1.ResetDeletedMsgs
GetOtherHeader - This method allows you to retrieve other header lines than what are currently provided for you via Properties. For example: the MsgSubject property holds the subject line header, but there is not a property for the "Content-transfer-encoding" header. You can use the GetOtherHeader method to retrieve any header that you wish from the currently selected message. If the header line doesn't exist the returning string will contain "<not found>"
Example: Dim strHeaderLine
strHeaderLine = FreePOP1.GetOtherHeader("Content-transfer-encoding:")
FreePOP Properties
POPHostname - This is a Read/Write property which is used to get/set the name of the POP3 server that you wish to connect to. The value can either be a raw TCPIP address or a DNS name.
Example: FreePOP1.POPHostname = "pop3.yourserver.com"
POPPort - This is a Read/Write property which is used to get/set the port the connect request to the POP3 server is done with. The default for this value is 110.
Example: FreePOP1.POPPort = 111
POPUsername - This is a Read/Write property which is used to get/set the username to use when connecting to the POP3 server.
Example: FreePOP1.POPUsername = "joeschmoe"
POPPassword - This is a Read/Write property which is used to get/set the password to use when connecting to the POP3 server.
Example: FreePOP1.POPPassword = "joespassword"
POPTimeout - This is a Read/Write property which is used to get/set the timeout value (in seconds) for all operations which require interaction with the POP3 server. The default value for this value is 10 seconds.
Example: FreePOP1.POPTimeout = 20
Status - This is a Read-Only property which holds a integer type value representing the status of a connection to a POP3 server.
Value of 0 means disconnected
Value of 1 means connected
StatusText - This is a Read-Only property which holds a text representation of the Status property.
Error - This is a Read-Only property which holds a integer type value representing any error that may have occurred from one of the FreePOP methods.
Value 0 = No error
Value 11 = Connection was accepted but no data received before timeout. Connection closed
Value 12 = Timeout waiting on connect request
Value 13 = Already connected
Value 14 = Error received from USER command:
Value 15 = Error received from PASS command:
Value 16 = Hostname cannot be blank
Value 17 = Username cannot be blank
Value 18 = Error received from STAT command:
Value 19 = Cannot set message number when disconnected
Value 20 = Cannot set message number less than or equal to 0 or greater than the message count
Value 21 = Error using the UIDL command:
Value 22 = Error using the TOP command:
Value 23 = Cannot retrieve message when disconnected
Value 24 = Cannot retrieve message number 0, use the SetCurrentMsg method
Value 25 = Error retrieving the message:
Value 26 = Error using the DELE (delete) command:
Value 27 = Cannot delete message when disconnected
Value 28 = Error using the RSET (reset) command:
Value 29 = Cannot reset deleted messages when disconnected
Value 30 = Error using the LIST command:Additionally Winsock may generate an error which can be reflected in the Error property of this control. The ErrorText property will give the text representation of these messages as well. For further information about the various Winsock errors that can occur, see the Visual Basic help file for the Winsock Control.
ErrorText - This is a Read-Only property which holds a text representation of the Error property.
MsgCount - This is a Read-Only property which holds the number of messages in the connected POP3 mailbox. This value is set during the Connect method.
MsgNumber - This is a Read-Only property which holds the number of the currently selected message. This value is set during the SetCurrentMsg method.
MsgUniqueID - This is a Read-Only property which holds a unique identifier provided by the POP3 server for the currently selected message. This value is set during the SetCurrentMsg method.
MsgHeaders - This is a Read-Only property which holds all the message headers of the currently selected message. This value is set during the SetCurrentMsg method.
MsgSubject - This is a Read-Only property which holds the "subject" line of the currently selected message. This value is set during the SetCurrentMsg method.
MsgFrom - This is a Read-Only property which holds the "from" line of the currently selected message. This value is set during the SetCurrentMsg method.
MsgReturnPath - This is a Read-Only property which holds the "Return-Path" line of the currently selected message. This value is set during the SetCurrentMsg method.
MsgReplyTo - This is a Read-Only property which holds the "Reply-To" line of the currently selected message. This value is set during the SetCurrentMsg method.
MsgDate - This is a Read-Only property which holds the "date" line of the currently selected message. This value is set during the SetCurrentMsg method.
MsgSizeInK - This is a Read-Only property which holds the size (in kilobytes) of the currently selected message. This value is set during the SetCurrentMsg method.
ConnectResponse - This is a Read-Only property which holds the initial response from the POP3 server when a connection is established in the Connect method. The main reason I included this was because some POP3 servers give the current time in GMT as part of their initial connection response.
MsgContents - This is a Read-Only property which holds the body of the currently selected message. This value is set during the RetrieveCurrentMsg method.
DebugMode - This is a run-time only property which can be set to True to initiate retrieving some debug information. This should be used only on request of the author.
DebugFile - This is a run-time only property for debug information, if the DebugMode property has been set to True. This should be used only on request of the author.
Example
Follow the below directions to set up an environment where you can process all messages in a POP3 mailbox.
1) Start a new project.
2) Go into Project/Components and ensure that the "Glenn Harm's FreePOP Control" control is available and checked.
3) Add a command button to the form.
4) Add a FreePOP control to the form. Ensure that it has the Name of FreePOP1
5) Add a Text box control to the form. Make it as big as possible and name it Text1. Set the MultiLine property to True, and the ScrollBars property to 2-Vertical
6) Copy and paste the below into the Code window of the form. Make appropriate changes for the POP server information
<START AREA TO COPY>
Private Sub Command1_Click() Dim intCount As Integer Command1.Enabled = False FreePOP1.POPHostname = "pop3.yourserver.com" FreePOP1.POPUsername = "yourusername" FreePOP1.POPPassword = "yourpassword" FreePOP1.Connect If FreePOP1.Error = 0 Then MsgBox FreePOP1.MsgCount, vbOKOnly, "Messages in mailbox" For intCount = 1 To FreePOP1.MsgCount FreePOP1.SetCurrentMsg (intCount) If FreePOP1.Error = 0 Then FreePOP1.RetrieveCurrentMsg Text1.Text = FreePOP1.MsgContents DoEvents If FreePOP1.Error = 0 Then ' Do whatever you want for each message here. MsgBox FreePOP1.MsgSubject, vbOKOnly, "Subject line" MsgBox FreePOP1.GetOtherHeader("Content-transfer-encoding:"), vbOKOnly, _ "An additional header" Else MsgBox FreePOP1.ErrorText, vbOKOnly, "Error during RetrieveCurrentMsg" End If Else MsgBox FreePOP1.ErrorText, vbOKOnly, "Error during SetCurrentMsg" End If Next FreePOP1.Disconnect Else MsgBox FreePOP1.ErrorText, vbOKOnly, "Error during Connect" End If Command1.Enabled = True End Sub
<END AREA TO COPY>
7) Run the project
Release History
Version 2.0.1 - Initial public release (February 15, 1998)
Version 2.0.2 (February 19, 1998)
Version 2.0.3 (March 15, 1998)
Special thanks to