ActiveXperts Email Component is a software development kit (SDK) that enables the user to send (SMTP) and receive (POP3) e-mail messages. ActiveXperts Email Component supports SMTP, POP3, multiple recipients (To, CC, BCC), multiple attachments (ASCII and binary), rich text body formats (RTF/HTML), Unicode, multiple character sets, SMTP authorization (AUTH PLAIN, AUTH LOGIN, AUTH CRAM MD5), POP3 authorization (Plain, APOP), POP3 header download, different character sets (including arabic, chinese, japanese, russian, greek, hebrew and many more), different encodings (including 7/8 bit, quoted-printable, base64).
In this example we are going to use Visual Studio 2008 to create an ASP.NET Visual Basic console application project named 'DemoApp' in a solution named 'DemoSolution'. We are going to store this project in the directory 'C:\MyProjects'. All of these names can be changed according to your preferences. This demo project will ask the user to give an e-mail address and a password on the command prompt.
You must install and configure Internet Information Services (IIS) before using ActiveXperts Email Component with ASP .NET If you don't have IIS installed, use the following stpes:
Download ActiveXperts Email Component from the ActiveXperts Download Site and start the installation. The installation guides you through the installation process.
Launch Microsoft Visual Studio from the Start menu. Choose 'New' from the 'File' menu and click on 'Web Site'. In the 'Web Site' dialog, select ASP .NET Web Site. Select a name for the application and a name for the solution. Also, select the directory where you want to store the project:
Now that a new project has been created, you must add a reference to ActiveXperts Email Component in the project to be able to use ActiveXperts Email Component objects. To do so, choose 'Add Reference...' from the 'Project' menu. In the 'Add Reference' dialog that pops up, select the 'COM' tab and select the ActiveXperts Email Component Type Library' as shown in the following picture:
Click 'OK' to close the 'Add Reference' dialog.
On top of your code, type the following line to declare ActiveXperts Email Component objects:
Imports AxEmail Imports System.IO Partial Public Class frmpop3 Inherits System.Web.UI.Page Private objPop3 As Pop3 = New Pop3 Private objEmailConstants As EMailConstants = New EMailConstants
The following code will download and display all messages from the POP3 server:
If (objPop3.LastError = 0) Then For i = 1 To numMessages objPop3Mail = objPop3.GetEmailHeader(i) txtResult.Text = objPop3.LastError.ToString() If (objPop3.LastError = 0) Then lvMessages.Items.Add(objPop3Mail.Date + "; " + objPop3Mail.FromAddress + "; Subject: " + objPop3Mail.Subject) End If Next End If
You can download the full source code of this project from the ActiveXperts FTP site: ftp://ftp.activexperts-labs.com/samples/smtp-pop3-component/. There are many other working samples included with the product or on the FTP site.
The ActiveXperts Email Component project ships with a set of Microsoft Visual Studio .NET samples. The projects are created with Microsoft Visual Studio 2008.
Users with a later version of Microsoft Visual Studio can open such a project. The Visual Studio Conversion Wizard will guide you through the process of converting the project to the version used.