ActiveEmail

 Product Overview

 How to use

 Online Samples

 Download (.exe)

 Brochure (.pdf)

 Manual (.htm)

 Release Notes


Support

 Knowledge Base

 Forum

 Contact Support


Purchase

 Licensing

 Pricing

 Order now


Related documents

 E-mail headers

 MIME encoding

 MIME and ActiveEmail

 SMTP via Telnet

 POP3 via Telnet

 RFC's supported:
 RFC 821,  RFC 822
 RFC 1521,  RFC 1522,
 RFC 2104,  RFC 2195,
 RFC 2449,  RFC 2554,
 RFC 2595,  more...


  Download ActiveEmail SMTP/POP3 Toolkit 3.1  (5020 KB - .exe file)
  Download Manual  (190 KB - .htm file)


Using ActiveEmail SMTP/POP3 Toolkit with Microsoft ASP .NET CSharp


ActiveEmail SMTP/POP3 Toolkit is a software development kit (SDK) that enables the user to send (SMTP) and receive (POP3) e-mail messages. ActiveEmail 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 and many more), different encodings (including 7/8 bit, quoted-printable, base64).

ActiveEmail can be well integrated into Microsoft Visual Studio .NET environments. This document describes how ActiveEmail can be integrated into Microsoft ASP .NET CSharp projects.


Prerequisites

You must install and configre Internet Information Services (IIS) before using ActiveEmail with ASP .NET
If you don't have IIS installed, use the following stpes:
  • From the Control Panel, click 'Add/Remove Programs'. Select the 'Add/Remove Windows Components' icon from the left pane, then select 'Application Server' and click on 'Details'. You can now select both 'ASP .NET' and 'Internet Information Services (IIS)'. Click 'OK' to continue installation;
  • Make sure that ASP .NET is allowed on the web server:


    (Click on the picture to enlarge)



Step 1: Download and install ActiveEmail

Download the ActiveEmail SMTP/POP3 Toolkit from the ActiveXperts Download Site and start the installation. The installation guides you through the installation process.



Step 2: Create a new ASP .NET C# Project

Launch Microsoft Visual Studio (for instance 'Microsoft Visual Studio 2005') 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 (for instance: 'DemoApp') and a name for the solution (for instance: 'DemoSolution'). Also, select the directory where you want to store the project (for instance: 'C:\MyProjects):

    
    (Click on the picture to enlarge)



Step 3: Refer to the ActiveEmail Library and create the objects

Now that a new project has been created, you must add a reference to ActiveEmail in the project to be able to use the ActiveEmail objects. To do so, choose 'Add Reference...' from the 'Website' menu. In the 'Add Reference' dialog that pops up, select the 'COM' tab and select the 'ActiveEmail 3.0 Type Library' as shown in the following picture:

    
    (Click on the picture to enlarge)

Click 'OK' to close the 'Add Reference' dialog.

On top of your code, type the following line to use the ActiveEmail namespace:
   using AEMAILLib;
In your Main function, declare and create the following objects for SMTP:
   SmtpServer objSmtpServer    = new SmtpServer();
   SmtpMail   objSmtpServer    = new SmtpMail();
To use POP3, declare and create the following objects:
   SmtpServer objPop3Server    = new Pop3Server();
   Pop3Mail   objPop3Mail;     // NOTE: do NOT create the Pop3Mail object, because it is created by the 
                               // Pop3Server object when a new message is received
To make use of ActiveEmail's constants, declare the EmailConstants object:
   EmailConstants objConstants = new EmailConstants();


Step 4: Send and/or receive an e-mail messages

You can now send and/or receive e-mail messages.

The following code shows how to send an e-mail message:
   using System;
   using System.Collections;
   using System.ComponentModel;
   using System.Data;
   using System.Drawing;
   using System.Web;
   using System.Web.SessionState;
   using System.Web.UI;
   using System.Web.UI.WebControls;
   using System.Web.UI.HtmlControls;
   using AEMAILLib;
   
   namespace SmtpDemo
   {
      /// <summary>
      /// Summary description for WebForm1.
      /// </summary>
      public class WebForm1 : System.Web.UI.Page
      {
         protected System.Web.UI.WebControls.Label labelServer;
         protected System.Web.UI.WebControls.TextBox textServer;
         protected System.Web.UI.WebControls.Label labelFromAddress;
         protected System.Web.UI.WebControls.TextBox textFromAddress;
         protected System.Web.UI.WebControls.Label labelFromName;
         protected System.Web.UI.WebControls.TextBox textFromName;
         protected System.Web.UI.WebControls.Label LabelMailTo;
         protected System.Web.UI.WebControls.TextBox textMailTo;
         protected System.Web.UI.WebControls.Label labelSubject;
         protected System.Web.UI.WebControls.TextBox textSubject;
         protected System.Web.UI.WebControls.Label labelBody;
         protected System.Web.UI.WebControls.TextBox textBody;
         protected System.Web.UI.WebControls.Label labelResult;
         protected System.Web.UI.WebControls.TextBox textResult;
         protected System.Web.UI.WebControls.Label labelResponse;
         protected System.Web.UI.WebControls.TextBox textResponse;
         protected System.Web.UI.WebControls.Button buttonSend;
   
         private SmtpServer       objSmtpServer;
         private SmtpMail         objSmtpMail;
         private EmailConstants   objConstants;
   
   
         private void Page_Load(object sender, System.EventArgs e)
         {
            objSmtpServer      = new SmtpServer();
            objSmtpMail		= new SmtpMail();
            objConstants       = new EmailConstants();
         }
   
         #region Web Form Designer generated code
         override protected void OnInit(EventArgs e)
         {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
         }
   
         /// <summary>
         /// Required method for Designer support - do not modify
         /// the contents of this method with the code editor.
         /// </summary>
         private void InitializeComponent()
         {    
            this.buttonSend.Click += new System.EventHandler(this.buttonSend_Click);
            this.Load += new System.EventHandler(this.Page_Load);
   
         }
         #endregion
   
         private void buttonSend_Click(object sender, System.EventArgs e)
         {
            objSmtpServer.LogFile = "C:\\AspNetSmtpLog.txt";
   
            objSmtpServer.Connect(textServer.Text, "", "");
   
            if ( GetResult() == 0 )
            {
               objSmtpMail.FromAddress = textFromAddress.Text;
               objSmtpMail.FromName	= textFromName.Text;
               objSmtpMail.AddTo( textMailTo.Text, "");
               objSmtpMail.Subject		= textSubject.Text;
               objSmtpMail.Body		= textBody.Text;
   
               objSmtpMail.BodyType = objConstants.asMESSAGE_BODY_PLAIN;
               objSmtpMail.Encoding = objConstants.asMESSAGE_ENCODING_DEFAULT;
               objSmtpMail.Priority = objConstants.asMESSAGE_PRIORITY_HIGH;
   
               object obj = objSmtpMail;
   
               objSmtpServer.Send  (ref obj );
   
              GetResult();
            }
         }
   
         private long GetResult()
         {
            long lResult = objSmtpServer.LastError;
   
            textResponse.Text = objSmtpServer.LastSmtpResponse;
   
            textResult.Text = "ERROR " + objSmtpServer.LastError.ToString() + " : " + objSmtpServer.GetErrorDescription(objSmtpServer.LastError);
   
            return lResult;
         }
      }
   }
There are many working samples included with the product. You can also find them on the ActiveXperts FTP site: ftp.activexperts-labs.com/samples/activemail.


NOTE: Demo Projects are created with Microsoft Visual Studio 2002

The ActiveEmail project ships with a set of Microsoft Visual Studio .NET samples, including samples for Microsoft ASP .NET C#. The projects are created with Microsoft Visual Studio 2002.
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.






ActiveEmail is a SMTP- and POP3 development component (SDK). This control can be used by any Windows development platform, including Visual Basic .NET, Visual CSharp .NET, ASP .NET (VB,CS), ASP, Visual Basic, Visual Studio/Visual C++, Delphi, PHP, HTML, VBScript and any other ActiveX/COM compliant platform. ActiveEmail is an ActiveXperts Software B.V. Product.

Copyright ©1999-2007 ActiveXperts Software. All rights reserved.