|
Download ActiveEmail SMTP/POP3 Toolkit 3.0  (4433 KB - .exe file)
Download Manual  (190 KB - .htm file)
Using ActiveEmail SMTP/POP3 Toolkit using VBScript
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 VBScript environments. This document describes how ActiveEmail can be usied with VBScript.
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 script
Create a new script using your favorite editor.
You can simply use notepad. However, a VBScript editor is recommended, so you can browse through objects, objects properties and object functions.
You're now able to write a more advanced ASP script to send/receive e-mail using ActiveEmail.
Step 3: Create the ActiveEmail objects in VBScript
Create a new VBScript file called DEMO.VBS. It is recommended to insert the following line on top of your code:
Option Explicit
This statement requires that all variable names be defined (with the Dim statement),
to avoid simple typos that can cause incredible headaches and long debugging sessions for something that should have never happened.
Now, declare the ActiveEmail SMTP objects:
Dim objSmtpServer
Dim objSmtpMail
Dim objConstants
Create the SMTP objects like this:
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )
Set objConstants = CreateObject( "ActiveXperts.EMailConstants" )
Similary, you can declare and create the POP3 objects:
Dim objPop3Server
Dim objPop3Mail
Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" )
' NOTE: do NOT create the Pop3Mail object, because it is created by the Pop3Server object when a new message is received
Now, add the following lines to the file to have your fist ActiveEmail VBScript program:
WScript.Echo "Version: " & objSmtpServer.Version
WScript.Echo "Expiration Date: " & objSmtpServer.Expiration Date
Step 4: Send and/or receive an e-mail messages
You can now send and/or receive e-mail messages.
The following VBScript code shows how to send an e-mail:
Option Explicit
Dim objSmtpServer, objSmtpMail, objConstants
Set objSmtpServer = CreateObject("ActiveXperts.SmtpServer")
Set objSmtpMail = CreateObject("ActiveXperts.SmtpMail")
Set objConstants = CreateObject("ActiveXperts.EMailConstants")
Wscript.Echo "ActiveEmail " & objSmtpServer.Version & " demo."
Wscript.Echo "Expiration date: " & objSmtpServer.ExpirationDate & vbCrLf
' For troubleshooting, specify a log file
' objSmtpServer.LogFile = "C:\ActiveEmail.log"
' Connect to SMTP mailserver
' If server credentails are required, pass Account name and Password as additional parameters
' If port other than default port 25 is required, set the HostPort property first
objSmtpServer.Connect( "smtp.mydomain.com" )
Wscript.Echo "Connect, result: " & objSmtpServer.LastError & " (" & objSmtpServer.GetErrorDescription( objSmtpServer.LastError ) & ")"
If( objSmtpServer.LastError <> 0 ) Then
WScript.Quit
End If
' Set mail properties
objSmtpMail.FromAddress = "sender@mydomain.com" ' Some mail servers (including MS Exchange) require an existing mail address on that server
objSmtpMail.FromName = "ActiveEmail Demo" ' Displayname
objSmtpMail.Subject = "ActiveEmail Message"
objSmtpMail.Priority = objConstants.asMESSAGE_PRIORITY_MEDIUM ' Normal (default) priority
objSmtpMail.BodyType = objConstants.asMESSAGE_BODY_PLAIN ' Plain body format (no RTF/HTML format)
objSmtpMail.Body = "Hello my friend," & vbCrLf & _
"How are you?" & vbCrLf & "Regards."
objSmtpMail.AddTo "recipient1@myrecipients.com", "Recipient 1" ' Call this function to add recipients
objSmtpMail.AddCc "recipient2@myrecipients.com", "Recipient 2" ' Call this function to add CC recipients
' Send mail now
objSmtpServer.Send( objSmtpMail )
WScript.Echo "Send, result: " & objSmtpServer.LastError & " (" & objSmtpServer.GetErrorDescription( objSmtpServer.LastError ) & ")"
If( objSmtpServer.LastSmtpResponse <> "" ) Then
WScript.Echo "Last response from SMTP Server: " & objSmtpServer.LastSmtpResponse
End If
' Disconnect
objSmtpServer.Disconnect
WScript.Echo "Disconnected."
WScript.Echo "Ready."
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.
|
|