The SocketTools Internet Message Access Protocol (IMAP) control is used to access a user's e-mail messages which are stored on a mail server. The control implements the current standard for this protocol, and provides functions to retrieve messages, or just certain parts of a message, create and manage mailboxes, search for specific messages based on certain criteria and so on. To download a free evaluation copy of SocketTools or for more information about this component, please select one of the following links:
The Internet Message Access Protocol (IMAP) is an application protocol which is functionally similar to the Post Office Protocol (POP3). However, unlike POP3 where messages are downloaded and processed on the local system, the messages on an IMAP server are retained on the server and processed remotely. This is ideal for users who need access to a centralized store of messages or have limited bandwidth. For example, traveling salesmen who have notebook computers or mobile users on a wireless network would be ideal candidates for using IMAP.
Another advantage that IMAP has is support for multiple mailboxes. Rather than just accessing the user's Inbox, the IMAP protocol allows users to create additional mailbox folders, store, delete and retrieve messages from them, as well as move messages from one mailbox to another. Mailboxes can also contain other mailboxes, supporting a hierarchical structure. The SocketTools IMAP control gives you complete control over the mailboxes and messages stored in them, enabling your application to integrate mail client functionality in your own application.
This control can also support secure connections using the standard SSL and TLS protocols. A SocketTools Secure Visual Edition license must be purchased to use the security features in this component.
The following are just some of the features in the SocketTools Internet Message Access Protocol control:
The following code example in Visual Basic demonstrates how the control can be used to retrieve all the messages from a user's Inbox and store them on the local system:
' Connect to the specified IMAP server, authenticating with a
' username and password provided by the user
nError = ImapClient1.Connect(strHostName, , strUserName, strPassword)
If nError <> 0 Then
MsgBox ImapClient1.LastErrorString, vbExclamation
Exit Sub
End If
' Select the default Inbox mailbox. This is the mailbox in which
' all new messages are stored.
nError = ImapClient1.SelectMailbox("Inbox")
If nError <> 0 Then
MsgBox ImapClient1.LastErrorString, vbExclamation
Exit Sub
End If
' For each message that is available in the user's Inbox, retrieve
' it and store it on a local text file
For nMessage = 1 To ImapClient1.MessageCount
strFileName = strMailDir & "\message" & nMessage & ".txt"
nError = ImapClient1.StoreMessage(nMessage, strFileName)
If nError <> 0 Then
MsgBox ImapClient1.LastErrorString, vbExclamation
Exit Sub
End If
Next
' Disconnect from the mail server
ImapClient1.Disconnect
In this example, there are four methods that are called: Connect, which establishes the connection to the mail server; SelectMailbox which selects the current mailbox that will be used; StoreMessage which retrieves the contents of the message and stores it in a file on the local system; and Disconnect, which closes the connection to the server.
As you can see, most of the code is actually related to error checking and comments, with only a few lines of code required to retrieve the messages from the server. If you wanted to store the contents of the message in a string or byte array, then you would use the GetMessage method instead but all of the other code would remain the same. You could also use this control in conjunction with the Mail Message control to parse the contents of the message and display specific portions of the message to the end user.
Product Overview
An overview of the product features and benefits.
SocketTools Controls
The ActiveX controls that are included with this edition.
Frequently Asked Questions
Answers to the most common questions about SocketTools.
Download Product
Download a free evaluation copy of SocketTools.
Purchase Online
Purchase a developers license for this product.
Technical Reference
Review the online technical reference documentation.
Release Notes
Release notes for the current version of SocketTools.
License Agreement
The developer license agreement for this product.