|
Download ActiveEmail SMTP/POP3 Toolkit 3.0  (4433 KB - .exe file)
Download Manual  (190 KB - .htm file)
Using ActiveEmail SMTP/POP3 Toolkit with PHP
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 LOIN, 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 PHP environments. This document describes how ActiveEmail can be integrated into PHP 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 the ActiveEmail objects in PHP
You must use PHP script to declare and create the ActiveEmail objects.
Use the following PHP code to create the SMTP objects:
$objSmtpServer = new COM ( "ActiveXperts.SmtpServer" );
$objSmtpMail = new COM ( "ActiveXperts.SmtpMail" );
Use the following PHP code to create the POP3 object:
$objPop3Server = new ActiveXObject ( "ActiveXperts.Pop3Server" );
' 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:
$objConstants = new COM ( "ActiveXperts.EMailConstants" );
Step 3: Send and/or receive an e-mail messages
You can now send and/or receive e-mail messages.
The following PHP code shows how to send an e-mail from a webform:
<html>
<head>
<META HTTP-EQUIV="CONTENT-Type" CONTENT="text/html;CHARSET=utf-8" >
<title>ActiveXperts ActiveEmail PHP Sample</title>
</head>
<body>
<font face="sans-serif" size="2">
<hr size="1" color="#707070">
<font size="4">ActiveXperts ActiveEmail PHP Sample</font>
<br>
<br>
<b>Send an e-mail message to a recipient through an SMTP connection.</b>
<br>
<br>
<hr size="1" color="#707070">
<br>
<?php
$objSmtpServer = new COM ( "ActiveXperts.SmtpServer" );
$objSmtpMail = new COM ( "ActiveXperts.SmtpMail" );
$objConstants = new COM ( "ActiveXperts.EmailConstants" );
$objSmtpServer->Logfile = "C:\\PhpSmtpLog.txt";
$objSmtpServer->Connect ( $_POST['MailServer'] );
if ( $objSmtpServer->LastError == 0 )
{
$objSmtpMail->AddTo ( $_POST['ToAddress'], "" );
$objSmtpMail->FromAddress = $_POST['FromAddress'];
$objSmtpMail->FromName = $_POST['FromName'];
$objSmtpMail->Subject = $_POST['Subject'];
$objSmtpMail->Body = $_POST['Message'];
$objSmtpMail->Priority = $objConstants->asMESSAGE_PRIORITY_HIGH;
$objSmtpMail->BodyType = $objConstants->asMESSAGE_BODY_PLAIN;
$objSmtpMail->Encoding = $objConstants->asMESSAGE_ENCODING_DEFAULT;
$objSmtpServer->Send ( $objSmtpMail );
}
if ( $objSmtpServer->LastError == 0 )
{
Echo "Message successfully submitted.";
}
else
{
$ErrorNum = $objSmtpServer->LastError;
$ErrorDes = $objSmtpServer->GetErrorDescription ( $ErrorNum );
Echo "Error sending message: #$ErrorNum ($ErrorDes).";
}
?>
<br>
<br>
<hr size="1" color="#707070">
<font size="1" face="Verdana">This demo uses ActiveXperts ActiveEmail
</body>
</html>
This PHP code can be used with the following webform:
<html>
<head>
<META HTTP-EQUIV="CONTENT-Type" CONTENT="text/html;CHARSET=utf-8" >
<title>ActiveXperts ActiveEmail PHP Sample</title>
</head>
<body>
<font face="sans-serif" size="2">
<hr size="1" color="#707070">
<font size="4">ActiveXperts ActiveEmail PHP Sample</font>
<br>
<br>
<b>Send an e-mail message to a recipient through an SMTP connection.</b>
<br>
<br>
<hr size="1" color="#707070">
<br>
<form action="send.php" method="post" >
<table border="0" bgcolor="#f0f0f0" ID="Table1">
<tr>
<td valign="top">Mail Server:</td>
<td>
<input size="50" type="text" name="MailServer" value="smtp.mycompany.com"><br>
</td>
</tr>
<tr>
<td valign="top">From Address:</td>
<td>
<input size="50" type="text" name="FromAddress" value="info@mycompany.com"><br>
</td>
</tr>
<tr>
<td valign="top">From Name:</td>
<td>
<input size="50" type="text" name="FromName" value="My name"><br>
</td>
</tr>
<tr>
<td valign="top">To Address:</td>
<td>
<input size="50" type="text" name="ToAddress" value="recpt@mycompany.com"><br>
</td>
</tr>
<tr>
<td valign="top">Subject:</td>
<td>
<input size="50" type="text" name="Subject" value="The Subject"><br>
</td>
</tr>
<tr>
<td valign="top">Message:</td>
<td>
<textarea rows="4" name="Message" cols="40">Hello, world from PHP</textarea>
</td>
</tr>
</table>
<br>
<input type="submit" value="Send Message">
<br>
<br>
<b>IMPORTANT:</b> Please press the button <b>only once</b>, and allow some time for the e-mail to be processed.
</form>
<br>
<hr size="1" color="#707070">
<font size="1" face="Verdana">This demo uses the ActiveXperts ActiveEmail</font>
</body>
</html>
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.
|
|