|
Download ActiveEmail SMTP/POP3 Toolkit 3.0  (4433 KB - .exe file)
Download Manual  (190 KB - .htm file)
Using ActiveEmail SMTP/POP3 Toolkit with ASP 2.x
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 ASP environments. This document describes how ActiveEmail can be integrated into ASP 2.x projects.
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 Web Site
First, create a new directory on the IIS Server's file system. This directory will hold the ASP later on.
From the 'Start menu', click on 'Administrative Tools' and click on 'Internet Information Services (IIS) Manager'. Right-click on the 'Web Sites' container and choose 'New->Web Site':

(Click on the picture to enlarge)
The 'Web Site Creation Wizard' is shown, guiding you thorugh the process of creating a new web site. Provide all necessary information:
- Description - a friendly description of the new site;
- IP / Port / Host Header - choose your preferred way to distinguish between other web sites on the server;
- Path - select the directory that will store the ASP file(s);
- Web Site Access Permissions - in the Web Site Access Permissions dialog, enable 'Read' and 'Run scripts (such as ASP)';
You're now able to write an ASP script to send/receive e-mail using ActiveEmail.
Step 3: Create the ActiveEmail objects in ASP
Create a new ASP script called DEFAULT.ASP in the directory that was created in Step2, using your favorite editor.
On top of the ASP code, insert the following lines to declare and create the SMTP objects:
<object runat=server progid="ActiveXperts.SmtpServer" id=objSmtpServer></object>
<object runat=server progid="ActiveXperts.SmtpMail" id=objSmtpMail></object>
Insert the following lines to declare and create the POP3 objects:
<object runat=server progid="ActiveXperts.Pop3Server" id=objPop3Server></object>
' NOTE: do NOT create the Pop3Mail object, because it is created by the Pop3Server object when a new message is received
Insert the following lines to declare and create the constants object:
<object runat=server progid="ActiveXperts.EMailConstants" id=objConstants></object>
Step 4: Test a small piece of ASP
Now, test if your new web site is working well with ActiveEmail using your browser.
If you are using Microsoft Internet Explorer, it is recommended to disable friendly error message because this default setting doesn't show any ASP error message, making it hard to debug if there are any problems:
- Choose' Internet Options' from the 'Tools' menu;
- Select the 'Advanced' tab;
- In the 'Browsing' folder, de-select the 'Show friendly HTTP error messages' option;
- Click 'OK' to close the dialog.
Now, use the following piece of code in your DEFAULT.ASP page:
<object runat=server progid="ActiveXperts.SmtpMail" id=objMail ></object>
<object runat=server progid="ActiveXperts.EmailConstants" id=objConst></object>
<object runat=server progid="ActiveXperts.SmtpServer" id=objServer></object>
<html>
<head>
<title>ActiveEmail Demo</title>
</head>
<body>
ActiveEmail version: <% = objServer.Version %><br>
ActiveEmail expiration date: <% = objServer.Version %>
</body>
</html>
And test it with your favorite browser. The result should be like this:

(Click on the picture to enlarge)
Step 5: Send and/or receive an e-mail messages
You can now send and/or receive e-mail messages.
The following ASP code shows how to send an e-mail:
<%
' **************************************************
' ASP Sample: Send an email using SMTP
'
' For more info, please visit http://www.activexperts.com/activemail
'
' **************************************************
%>
<object runat=server progid="ActiveXperts.SmtpMail" id=objMail ></object>
<object runat=server progid="ActiveXperts.EmailConstants" id=objConst></object>
<object runat=server progid="ActiveXperts.SmtpServer" id=objServer></object>
<html>
<head>
<META HTTP-EQUIV="CONTENT-Type" CONTENT="text/html;CHARSET=utf-8" >
<title>ActiveXperts ActiveEmail <% = objServer.Version %> - ASP Sample</title>
</head>
<body>
<font face="sans-serif" size="2">
<hr size="1" color="707070">
<b><font size="4">ActiveXperts ActiveEmail <% = objServer.Version %> ASP Sample</font></b>
<br>
<br>
<b>Send an e-mail to a recipient through a SMTP server.</b>
<br>
<br>
<hr size="1" color="707070">
<br>
<%
If Request( "BUTTON_SEND" ) <> "" Then
objServer.Connect( Request( "STR_HOSTNAME" ) )
Response.Write "Connect, result: " & objServer.LastError & _
" (" & objServer.GetErrorDescription( objServer.LastError ) & ")" & "<br>"
If( objServer.LastError = 0 ) Then
objMail.FromAddress = Request( "STR_FROMADDRESS" )
objMail.FromName = Request( "FROM_NAME" )
objMail.AddTo Request( "STR_TOADDRESS" ), Request( "STR_TONAME" )
objMail.Priority = objConst.asMESSAGE_PRIORITY_HIGHEST
objMail.Subject = Request( "STR_SUBJECT" )
objMail.BodyType = objConst.asMESSAGE_BODY_PLAIN
objMail.Body = Request( "STR_BODY" )
objServer.Send objMail
%>
<% If objServer.LastError = 0 Then %>
<h2>Your message was submitted successfully.</h2>
<% Else %>
<b><font size="2" color="700000">Failed to send message, ERROR#<% = objServer.LastError %>.</font></b><br>
<% End If %>
<%
objServer.Disconnect() ' Always successfull
End If
Else
%>
<br>
<form action="Default.asp" method=post>
<table>
<td width="20"></td><td>SMTP Server:</td><td><input size=40 type=text name="STR_HOSTNAME" value="smtp.myserver.com"></td><tr>
<td></td><td>FromAddress:</td><td><input size=40 type=text name="STR_FROMADDRESS" value="myname@mycompany.com"></td><tr>
<td></td><td>FromName:</td><td><input size=40 type=text name="STR_FROMNAME" value="My Name"></td><tr>
<td></td><td>ToAddress:</td><td><input size=40 type=text name="STR_TOADDRESS" value="roger@thecompany.com"></td><tr>
<td></td><td>ToName:</td><td><input size=40 type=text name="STR_TONAME" value="My friend Roger"></td><tr>
<td></td><td>Subject:</td><td><input size=40 type=text name="STR_SUBJECT" value="My friend Roger"></td><tr>
<td></td><td>Body:</td><td><textarea rows="6" name="STR_BODY" cols="40"></textarea></td><tr>
<td></td><td></td><td><input type=Submit name="BUTTON_SEND" value="Send the message"></td><tr>
</table>
</form>
<b>IMPORTANT:</b> Please press the button <b>only once</b>, and allow some time for the e-mail to be processed.
<br>
<hr size="1" color="707070">
<font size="1" face="Verdana">This demo uses ActiveXperts ActiveEmail.</font>
</font>
</body>
</html>
<% End If %>
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.
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.
|
|