FreePOP 4.0.1
By: Glenn Harm Date: 07/08/2000
File:

freepop_full.zip

Size:

1.47 MB

Download now!

FreePOP is an ActiveX control that allows read/write access to a POP3 mailbox and the messages in the mailbox. With this control you will not be able, on the other end, to access a SMTP server to send e-mail.
With this ActiveX control, you can:

Once you have added the control to a form, it will be invisible and you'll be able to manage it with a set of properties and methods.

Property Desription
POPHostname The name or IP of the POP3 server to access.
(
i.e. pop.yourserver.com)
POPPort The port FreePOP should connect to. It is usually 110.
POPUsername The username to use when connceting. Often corrensponding to the left part of the e-mail address.
POPPassword Password associated with the username for authentication.
MsgCount Number of messages (usually new messages) found on the server.
MsgNumber Holds the number of the currently selected message in the list.
MsgHeaders Use to retrieve the full headers of the current message.
MsgSubject Use to retrieve the subject of the current message.
MsgFrom Use to retrieve the sender of the current message.
MsgContents Use to retrieve the body of the current message.
NOTE: it will work only for messages that are less then 64 KB in size.
MsgSizeinK Returns the size of the message in kilobytes (KB).

Method Desription
Connect Used to connect to the POP3 server and send username/password.
Disconnect Closes the connect previously enstabilished.
SetCurrentMsg n Makes the message specified by n the current message and read all its attributes (headers, from, subject) into a set of control properties (see above). It does not retrieve the message body.
RetrieveCurrentMsg Downloads the body of the current message, copying it into the MsgContents property. It does not remove the message from the server.
DeleteCurrentMsg Marks the current message for delation upon disconnection.
ResetDeletedMsgs Unmarks all messages previously marked for delation.
WriteCurrentMsgToFile filename Downloads the message body into the file specified in filename. Useful with big messages with attachments, as it can overcome the 64 KB limit of the MsgContents property.

Example

The following example code demonsrates how to parse all new messages and read their contents.
Create a new project and add a command button, a textbox and a FreePOP control to Form1.
Then, copy the following code into the form.

Private Sub Command1_Click()
    Dim intCount As Integer
    Command1.Enabled = False
    FreePOP1.POPHostname = "pop.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"
                Else
                    MsgBox FreePOP1.ErrorText, vbOKOnly, "Error"
                End If
            Else
                MsgBox FreePOP1.ErrorText, vbOKOnly, "Error"
            End If
        Next
        FreePOP1.Disconnect
    Else
        MsgBox FreePOP1.ErrorText, vbOKOnly, "Error"
    End If
    Command1.Enabled = True
End Sub

Remember to set the servername, username and password.

The ZIP archive contains a HTML guide to the control. Be sure to read it.

To install, extract the contents of the ZIP archive in a custom folder and run Setup.Exe. To use the control, go to Project>Components in VB and mark the line FreePOP 4.0.1. Remember that the control is invisible at runtime.

Click Here!


Visual Basic Programming Zone is a website by Lorenzo Dalla Vecchia.
To contact the Webmaster, click here.
Hosted by InWind: www.inwind.it