ActiveEmail SMTP/POP3 Toolkit Manual

© 2010 ActiveXperts Software B.V.  contact@activexperts.com

 

Table of Contents

PART I: Getting Started

  1. Introduction
  2. System Requirements
  3. Installation
  4. How to use ActiveEmail

PART II: Objects

  1. SmtpMail object
  2. SmtpServer object
  3. Pop3Mail object
  4. Pop3Server object

PART III: Queue Service

  1. ActiveEmail Queue Server

PART III: Support, Licensing

  1. Constants and Error Codes
  2. Support
  3. Purchase and Product Activation
  4. Appendix A: License Agreement

1. Introduction

1.1. What is ActiveEmail?

ActiveEmail provides an easy-to-use scripting interface to SMTP and POP3 e-mail communications.
It's perfectly suited for situations in which e-mails have to be sent/received automatically, or in batches, from within applications, webservers, or from the command-line. The performance of the engine is outstanding, due to its multi-threaded architecture and its (optional) queuing features. It has proven its strength in many business environments over the years.

ActiveEmail features the following:

ActiveEmail can be used by any of the following operating systems:

ActiveEmail includes samples for many development tools, including:


1.2. ActiveEmail Architecture

ActiveEmail is built on top of the Microsoft WinSock drivers. It does NOT replace any Windows drivers during installation; it neither adds any files or components to the Windows or Windows System directory.

The core of ActiveEmail is an ActiveX/COM component that comes in a 32-bit and a 64-bit version:

ActiveEmail can be distributed easily to many PC's. Once you have purchased the licenses, you copy the AEmail.dll to the PCs and register the DLL on that PC.

2. System requirements

2.1. Supported Operating Systems

ActiveEmail Toolkit can be used by any of the following operating systems:

NOTE: On 64 bits systems, you can run 32- and 64 bit programs. To integrate ActiveEmail in a 64-bit (web) application of service, use the 64-bit AEmailx64.dll. To integrate ActiveEmail in a 32-bit (web) application of service, use the 32-bit AEmail.dll.

2.2. Supported Development Platforms

The ActiveEmail Toolkit can be used by any of the following programming languages:

3. Installation

The ActiveEmail Toolkit package consists of 4 components; any combination of components can be installed:

3.1. Installation on a single computer

Simply run the AMAIL.EXE Setup program. The InstallShield wizard will guide you through the rest of the setup.
If you choose the ActiveEmail Toolkit COM component, the Setup program can perform the registration of the COM component for you. But it will also give you the opportunity to register the object yourself.

Any subsequent installation of ActiveEmail Toolkit can be performed either manually or by using the Setup program.

3.2. Installation on multiple computers

Any subsequent installations can be performed using the setup program.
Since the installation of the core components is very easy, you may want to do it manually, or integrate it into your companies software distribution program.

If you choose to install the COM component manually on other machines, simply perform the following actions:

If you choose to install the Queue component manually on another machine, simply perform the following actions:

Queuing:

Click here to read more about the ActiveEmail Queue Configuration.

4. How to use ActiveEmail

4.1. Introduction

The following code snippets (VBScript) illustrate how to use various ActiveEmail objects.

Send a simple e-mail message
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )   ' Create SmtpServer object 
Set objSmtpMail= CreateObject( "ActiveXperts.SmtpMail" )        ' Create SmtpMail object 
objSmtpServer.Connect( "smtp.mydomain.com" )                    ' Establish connection 
If( objSmtpServer.LastError = 0 ) Then
  objSmtpMail.FromAddress = "sender@mydomain.com"               ' From (e-mail address) 
  objSmtpMail.FromName    = "ActiveEmail Demo"                  ' From (name) 
  objSmtpMail.Subject     = "ActiveEmail Message"
  objSmtpMail.Body        = "Hello, how are you?"
  objSmtpMail.AddTo "frank@myrecipients.com", "Frank"           ' Add a recipient 

 objSmtpServer.Send( objSmtpMail )                              ' Send mail now 
 objSmtpServer.Disconnect                                       ' Disconnect 
End If
Send an e-mail message: high priority, HTML formatted, to multiple recipients
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )   ' Create SmtpServer object
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )       ' Create SmtpMail object
Set objConstants = CreateObject( "ActiveXperts.EMailConstants" )  ' Create constants object
objSmtpServer.Connect( "smtp.mydomain.com" )                    ' Establish connection
If( objSmtpServer.LastError = 0 ) Then
  objSmtpMail.FromAddress = "sender@mydomain.com"               ' From (e-mail address)
  objSmtpMail.FromName    = "ActiveEmail Demo"                  ' From (name)
  objSmtpMail.Subject     = "ActiveEmail Message"
  objSmtpMail.Priority    = objConstants.asMESSAGE_PRIORITY_HIGH  ' High priority
  objSmtpMail.BodyType    = objConstants.asMESSAGE_BODY_HTML    ' RTF/HTML body format)
  objSmtpMail.Body        = "<b>Hello, how are you?</b><br>I'm fine"
  objSmtpMail.AddTo  "frank@myrecipients.com", "Frank"          ' Add a recipient
  objSmtpMail.AddTo  "harry@myrecipients.com", "Harry"          ' Add a recipient
  objSmtpMail.AddCc  "joseph@myrecipients.com", "Joseph"        ' Add a CC recipient
  objSmtpMail.AddBcc "john@myrecipients.com", "John"            ' Add a BCC recipient

 objSmtpServer.Send( objSmtpMail )                              ' Send mail now
 objSmtpServer.Disconnect                                       ' Disconnect
End If
Send an e-mail message with attachments
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )   ' Create SmtpServer object
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail" )       ' Create SmtpMail object
objSmtpServer.Connect( "smtp.mydomain.com" )                    ' Establish connection
If( objSmtpServer.LastError = 0 ) Then
  objSmtpMail.FromAddress = "sender@mydomain.com"                  
  objSmtpMail.FromName    = "ActiveEmail Demo"                     
  objSmtpMail.Subject     = "ActiveEmail Message"
  objSmtpMail.Body        = "Hello, how are you?"
  objSmtpMail.AddTo "frank@myrecipients.com", "Frank"              
  objSmtpMail.AddAttachment ".\picture1.jpg"                    ' Add attachment
  objSmtpMail.AddAttachment ".\picture2.jpg"                    ' Add anotherattachment

 objSmtpServer.Send( objSmtpMail )                              ' Send mail now
 objSmtpServer.Disconnect                                       ' Disconnect
End If
Receive e-mail headers
Set objPop3Server = CreateObject ( "ActiveXperts.Pop3Server" )  ' Create Pop3Server object
objPop3Server.Connect "pop3.mydomain.com", "acc", "passwd"      ' Connect to server, login using POP3 account 'acc'
If( objPop3Server.LastError = 0 ) Then
  numMessages = objPop3Server.CountMessages()
  For i = 1 to numMessages                                      ' Iterate over all POP3 messages
     Set objPop3Mail = objPop3Server.GetEmailHeader( i )
     If ( objPop3Server.LastError = 0 ) Then
        WScript.Echo "MessageID        : " & objPop3Mail.ID
        WScript.Echo "   FromAddress   : " & objPop3Mail.FromAddress 
        WScript.Echo "   FromName      : " & objPop3Mail.FromName 
        WScript.Echo "   To            : " & objPop3Mail.ToAddress
        WScript.Echo "   Subject       : " & objPop3Mail.Subject
        WScript.Echo "   Date          : " & objPop3Mail.Date  
        WScript.Echo vbCrLf 
     End If
  Next
  objSmtpServer.Disconnect                                      ' Disconnect
End If
Receive an e-mail
Set objPop3Server = CreateObject ( "ActiveXperts.Pop3Server" )  ' Create Pop3Server object
objPop3Server.Connect "pop3.mydomain.com", "acc", "passwd"      ' Connect to server, login using POP3 account 'acc'
If( objPop3Server.LastError = 0 ) Then

  numMessageID    = CInt( inputbox( "1", "Enter message ID (1 <= Message ID <= Count" )

  Set objPop3Mail = objPop3Server.GetEmail ( numMessageID )
  If( objPop3Server.LastError = 0 ) Then
     WScript.Echo "MessageID       : " & objPop3Mail.ID
     WScript.Echo "  From          : " & objPop3Mail.FromAddress
     WScript.Echo "  To            : " & objPop3Mail.ToAddress
     WScript.Echo "  Cc            : " & objPop3Mail.CcAddress
     WScript.Echo "  Reply Address : " & objPop3Mail.ReplyAddress	
     WScript.Echo "  Subject       : " & objPop3Mail.Subject
     WScript.Echo "  Priority      : " & objPop3Mail.Priority
     WScript.Echo "  Date          : " & objPop3Mail.Date
     WScript.Echo "  Hash          : " & objPop3Mail.Hash
     WScript.Echo "  Header        : " & Left ( objPop3Mail.Header, InStr ( objPop3Mail.Header, vbCrLf ) )	
     WScript.Echo "  Body          : " & Left ( objPop3Mail.Body, InStr ( objPop3Mail.Body, vbCrLf ) )
     WScript.Echo "  Attachments   : " & objPop3Mail.CountAttachments & vbCrLf

     numAttachments = objPop3Mail.CountAttachments 
     For i = 1 to numAttachments                                ' Iterate over all attachments
       WScript.Echo "Attachment  : " & objPop3Mail.GetAttachment ( i )
     Next
  End If
  objSmtpServer.Disconnect                                      ' Disconnect
End If

4.2. Visual Basic .NET

Make sure the ActiveEmail Toolkit is installed on your system. For details about installation, click here.

Add a reference to the object using the Visual Basic Solution Explorer:

You can use different ActiveEmail objects in one Visual Basic .NET application. The following code shows how to declare and create all ActiveEmail objects:

Imports AEmail

Dim objConstants As EMailConstants               ' Declaration
objConstants = New EMailConstants()              ' Creation

Dim objSmtpServer As SmtpServer                  ' Declaration
objSmtpServer = New SmtpServer()                 ' Creation

Dim objSmtpMail As SmtpMail                      ' Declaration
objSmtpMail = New SmtpMail()                     ' Creation

Dim objPop3Server As Pop3Server                  ' Declaration
objPop3Server = New Pop3Server ()                ' Creation

Dim objPop3Mail As Pop3Mail                      ' Declaration
objPop3Mail = New Pop3Mail()                     ' Creation

After these declarations and creation of the object(s), you can use the objects inside your Visual Basic .NET project.

4.3. Visual C# .NET

Make sure the ActiveEmail Toolkit is installed on your system. For details about installation, click here.

Add a reference to the object using the Visual C# Solution Explorer:

You can use different ActiveEmail objects in one Visual C# .NET application. The following code shows how to declare and create the ActiveEmail objects:

using AEMAILLib

EMailConstants objConstants;                     // Declaration
objConstants = new EMailConstants();             // Creation

SmtpServer objSmtpServer;                        // Declaration
objSmtpServer = new SmtpServer();                // Creation

SmtpMail objSmtpMail;                            // Declaration
objSmtpMail = new SmtpMail();                    // Creation

Pop3Server objPop3Server;                        // Declaration
objPop3Server = new Pop3Server();                // Creation

Pop3Mail objPop3Mail;                            // Declaration
objPop3Mail = new Pop3Mail();                    // Creation

After these declarations and creation of the object(s), you can use the objects inside your Visual C# .NET project.

4.4. Visual Basic

ActiveEmail can be used in Visual Basic 5.x or higher. In Visual Basic, go to the 'Project/References...' menu item and check the box next to ActiveEmail Type Library. Now, you can declare and create ActiveEmail objects.

Create new ActiveEmail objects using the 'CreateObject' function:

Dim objConstants As AEMAILLib.EMailConstants                    ' Declaration
Set objConstants = CreateObject("ActiveXperts.EMailConstants")  ' Creation

Dim objSmtpServer As AEMAILLib.SmtpServer                       ' Declaration
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )   ' Creation
Dim objSmtpMail  As AEMAILLib.SmtpMail                          ' Declaration
Set objSmtpMail = CreateObject( "ActiveXperts.SmtpMail")        ' Creation

Dim objPop3Server As AEMAILLib.Pop3Server                       ' Declaration
Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" )   ' Creation
Dim objPop3Mail  As AEMAILLib.Pop3Mail                          ' Declaration
Set objPop3Mail = CreateObject( "ActiveXperts.Pop3Mail")        ' Creation

After these declarations and creation of the object(s), you can use the objects inside your Visual Basic 5.x/6.x project.

4.5. How to use ActiveEmail in Visual C++

ActiveEmail can be used in Visual C++ projects. Include the *.h and *.c file provided by ActiveXperts to bind your code to the ActiveEmail component. These files are located in the Include directory of the Visual C++ samples directory. These are the files:

Declare and create new ActiveEmail objects like this:

IEMailConstants *pConstants;                                    
CoCreateInstance(CLSID_EMailConstants, NULL, CLSCTX_INPROC_SERVER, IID_IEMailConstants, (void**) &pConstants );

ISmtpServer *pSmtpServer;              
CoCreateInstance(CLSID_SmtpServer, NULL, CLSCTX_INPROC_SERVER, IID_ISmtpServer, (void**) &pSmtpServer ); 
ISmtpMail *pSmtpMail;             
CoCreateInstance(CLSID_SmtpMail, NULL, CLSCTX_INPROC_SERVER, IID_ISmtpMail, (void**) &pSmtpMail );

IPop3Server *pPop3Server;              
CoCreateInstance(CLSID_Pop3Server, NULL, CLSCTX_INPROC_SERVER, IID_IPop3Server, (void**) &pPop3Server ); 
IPop3Mail *pPop3Mail;             
CoCreateInstance(CLSID_Pop3Mail, NULL, CLSCTX_INPROC_SERVER, IID_IPop3Mail, (void**) &pPop3Mail );

Visual C++ samples are installed as part of the product, but can also be found on our website.

4.6. How to use ActiveEmail in an ASP 2.x environment

<html>
<body>
Version:
<script language=vbscript runat=server>
  Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )
  Response.Write objSmtpServer.Version
</script>
</body>
</html>

4.7. How to use ActiveEmail in Delphi 7.x or higher

Make sure the ActiveEmail Toolkit is installed on your system. For details about installation, click here.

First, add a reference to the ActiveEmail objects:

Create the various ActiveEmail object instances like this:

objConst       : IEMailConstants;                               { Declaration of the interface class  }
objConst       := TEMailConstants.Create(Form1).DefaultInterface;  { Creation new instance of the object }

objSmtpServer  : ISmtpServer;                                   { Declaration of the interface class  }
objSmtpServer  := TSmtpServer.Create(Form1).DefaultInterface;   { Creation new instance of the object }       
objSmtpMail    : ISmtpMail;                                     { Declaration of the interface class  }
objSmtpMail    := TSmtpMail.Create(Form1).DefaultInterface;     { Creation new instance of the object }
 
objPop3Server  : IPop3Server;                                   { Declaration of the interface class  }
objPop3Server  := TPop3Server.Create(Form1).DefaultInterface;   { Creation new instance of the object }       
objPop3Mail    : IPop3Mail;                                     { Declaration of the interface class  }
objPop3Mail    := TPop3Mail.Create(Form1).DefaultInterface;     { Creation new instance of the object } 

After these declarations and creation of the object(s), you can use the objects in your Delphi projects.

5. SmtpMail Object

5.1. SmtpMail Object - Introduction

The SmtpMail object includes all properties of an outgoing e-mail message, and is used by the SmtpServer object, in the functions:

Use SmtpMail object to send an e-mail

The following sample shows how to create a new e-mail message so it can be sent via SMTP:

Set objSmtpMail = CreateObject("ActiveXperts.SmtpMail")         ' Create SmtpMail object
objSmtpMail.FromAddress = "sender@mydomain.com"                 ' From (e-mail address)
objSmtpMail.FromName    = "ActiveEmail Demo"                    ' From (name)
objSmtpMail.Subject     = "ActiveEmail Message"                 ' Subject
objSmtpMail.Body        = "Hello, how are you?"                 ' Body
objSmtpMail.AddTo "frank@myrecipients.com", "Frank"             ' Add a recipient

' Create a new SmtpServer object; connect to the mail server
Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )   ' Create SmtpServer object
objSmtpServer.Connect( "smtp.mydomain.com" )                    ' Establish connection
If( objSmtpServer.LastError <> 0 ) Then
   WScript.Quit
End If

' Send the message
objSmtpServer.Send( objSmtpMail )                               ' Send mail now

objSmtpServer.Disconnect                                        ' Disconnect

5.2. SmtpMail Object - Overview of Properties and Functions

Property Type In/Out Mand/Opt Description
FromAddress String In/Out O The Sender's e-mail address
FromName String In/Out M The Sender's name
Organization String In/Out O The Sender's organization name
ReplyAddress String In/Out O The Sender's reply-address. If not specified, FromAddress will be the reply-address
ReadReceiptAddress String In/Out O E-mail address of the person who should receive read receipt(s) of the outgoing e-mail
Encoding Number In/Out O The encoding to be used. Various encodings are supported, including: Japanese, Chinese, Russian, Greek, Turkish and more
Subject String In/Out O The Subject of the message
Priority Number In/Out O The Priority of the message. There a five different priority-levels
BodyType Number In/Out O The Body type of the message
Body String In/Out O The Body of the message
LastError Number Out n/a Result of a previously called function

Function Description
Clear Clear all properties
AddTo Add an e-mail recipient
AddCc Add a Carbon Copy Recipient (CC)
AddBcc Add a Blind Carbon Copy Recipient (BCC)
AddAttachment Add an attachment
LoadMIME Load properties, recipients and attachments from a MIME file
SaveMIME Save properties, recipients and attachments to a MIME file

5.3. SmtpMail Object - Properties

SmtpMail.FromAddress,
SmtpMail.FromName properties

Type:

String

Description:

The FromAddress and FromName fields specify the Sender. The FromAddress specifies the Sender's e-mail address. This is the return-path for your e-mail, unless you specify the ReplyAddress property. The ReplyAddress property always overrides the FromAddress property for it's return path. The FromName field specifies the sender's friendly name.
You can only declare one sender.
FromAddress and FromName are optional properties, because RFC 822 doesn't require a sender specification for e-mail transmissions.

Example:

Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")   ' Create SmtpMail instance
...
objSmtpMail.FromAddress    = "me@mydomain.doc"
objSmtpMail.FromName       = "This is Me"
...

SmtpMail.Organization property

Type:

String

Description:

The sender's organization name.

Example:

Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")   ' Create SmtpMail instance
...
objSmtpMail.Organization   = "My Organization"
...

SmtpMail.ReplyAddress property

Type:

String

Description:

The Reply-address of the e-mail. If not specified, the reply-address will be the address indicated by the FromAddress property.

Example:

Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")   ' Create SmtpMail instance
...
objSmtpMail.ReplyAddress   = "myself@mydomain.com"
...

SmtpMail.ReadReceiptAddress property

Type:

String

Description:

E-mail address of the person who should receive a 'read receipt'. The receipt is sent when the message recipient has displayed your message. This is useful when you are sending time-critical information, or any time you want confirmation that your message has been received.

Example:

Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")   ' Create SmtpMail instance
...
objSmtpMail.ReadReceiptAddress = "myself@mydomain.com"
...

SmtpMail.Encoding property

Type:

Number

Description:

For a list of valid encoding values, click here.

Example:

Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")   ' Create SmtpMail instance
Set objConstants           = CreateObject("ActiveXperts.EMailConstants") ' Create EMailConstants instance
...
objSmtpMail.Encoding       = objConstants.asMESSAGE_ENCODING_KOREAN  ' Korean 
...

SmtpMail.Subject property

Type:

String

Description:

The Subject of a message. Not mandatory.

Example:

Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")   ' Create SmtpMail instance
...
objSmtpMail.Subject        = "This is an important message"
...

SmtpMail.Priority property

Type:

Number

Description:

The Priority of the message. There are 5 priority levels, described here.

Example:

Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")   ' Create SmtpMail instance
Set objConstants           = CreateObject("ActiveXperts.EMailConstants") ' Create EMailConstants instance
...
objSmtpMail.Priority       =  objConstants.asPRIORITYHIGH            ' High priority
...

SmtpMail.BodyType
SmtpMail.Body properties

Type:

Number, String

Description:

Two body formats are supported by ActiveEmail:

A message body in Plain Text format doesn't support any formatting capabilities; it doesn't support embedded objects either.
A message body in HTML format supports HTML text formatting tags, as well as embedded objects like images and sounds.

There are two values for the BodyType:

If you send a Plain Text message, you can include newlines by including vbCrLf characters inside you message. If you send a HTML message, you can embed an object inside the message. The object must be added as an attachment (see also: AddAttachment).
Every attachment has a unique identifier. The first attachment has identier 000001, the second one has 000002, etc.
To embed an attached object, you must refer to the object from within the message body. This referal can be made in the following way:
   <img SRC="cid:0000001">

Example: Clear Text formatted body

Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")   ' Create SmtpMail instance
Set objConstants           = CreateObject("ActiveXperts.EMailConstants") ' Create EMailConstants instance
...
' Default body format: plain text, so no need to change objSmtpMail.BodyType
objSmtpMail.Body           = "This is my body message." & vbCrLf & "Best regards."
...

Example: HTML formatted body

Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")   ' Create SmtpMail instance
Set objConstants           = CreateObject("ActiveXperts.EMailConstants") ' Create EMailConstants instance
...
objSmtpMail.BodyType       = objConstants.asMESSAGE_BODY_HTML        ' HTML formatted body
objSmtpMail.Body           = "<html><body>This is my <i>body message</i>.<br>Regards.</body></html>"
...

Example: HTML formatted body with to embedded objects

Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")   ' Create SmtpMail instance
Set objConstants           = CreateObject("ActiveXperts.EMailConstants") ' Create EMailConstants instance
...
objSmtpMail.AddAttachment "C:\MySelf.jpg"
objSmtpMail.AddAttachment "C:\MyWife.jpg"
objSmtpMail.BodyType       = objConstants.asMESSAGE_BODY_HTML        ' HTML formatted body with embedded objects
objSmtpMail.Body           = "<html><body>This <img SRC="cid:0000001"> is me" &_
                             "<br>and <img SRC="cid:0000002"> my wife<br></body></html>"
...

SmtpMail.LastError property

Type:

Number

Description:

This read-only property indicates the result of the last called function. You should always checks the result of your functions. A zero indicates: success. Any non-zero value means an error.
For a complete list of error codes, check out the following page: www.activexperts.com/support/errorcodes.

Example:

Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")   ' Create SmtpMail instance
...
objSmtpMail.AddAttachment( "C:\File.txt" )
WScript.Echo "Result code: " & objSmtpMail.LastError                 ' Result of AddAttachment function
...

5.4. SmtpMail Object - Functions

SmtpMail.Clear function

Description:

This function resets all Properties to the initial, default values.

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:

Set objSmtpServer          = CreateObject("ActiveXperts.SmtpServer") ' Create SmtpMail instance
Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")   ' Create SmtpMail instance
objSmtpServer.Connect( "smtp.domainname.com" )
If( objSmtpServer.LastError = 0 ) Then
  objSmtpMail.From         = "me@mydomain.com"
  objSmtpMail.AddTo "john@company.com", "My Friend John"
  objSmtpMail.Subject      = "This is my subject"
  objSmtpMail.Body         = "This is my message to you"
  objSmtpServer.Send( objSmtpMail )
  objSmtpMail.Clear                                                  ' Clear mail properties
  objSmtpMail.From         = "me@mydomain.com"
  objSmtpMail.AddTo "michael@company.com", "My Friend Michael"
  objSmtpMail.Subject      = "This is my subject"
  objSmtpMail.Body         = "This is my message to you"
  objSmtpServer.Send( objSmtpMail )
  objSmtpServer.Disconnect
End If

SmtpMail.AddTo,
SmtpMail.AddCc,
SmtpMail.AddBcc functions

Description:

Use AddTo to add a normal recipient, use AddCc to add a Carbon Copy recipient, and use AddBcc to add a Blind Carbon Copy recipient.
All three functions can be called multiple times, to add multiple recipients.

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:

Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")   ' Create SmtpMail instance
...
objSmtpMail.AddTo "roger@thecompany.com", "My friend Roger"
objSmtpMail.AddTo "mike@thecompany.com", ""
objSmtpMail.AddCc "dennis@thecompany.com", "My friend Dennis"
objSmtpMail.AddBcc "jim@thecompany.com", ""
objSmtpMail.AddBcc "joe@thecompany.com", "My friend Joe"
...

SmtpMail.Addattachment function

Description:

This function allows you to add one or more file attachment. These attachments can be either ASCII or binary format.
Every attachment has its own unique internal ID. You can use this ID to embed the attachment inside a Body message.

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:

Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")   ' Create SmtpMail instance
objSmtpMail.AddAttachment "c:\temp\mypicture.jpg"                    ' Add attachment
objSmtpMail.AddAttachment "c:\temp\mydocument.doc"                   ' Add attachment
...

SmtpMail.LoadMIME function

Description:

This function loads all properties, recipients and attachments from a MIME file. This can be a MIME file that was created by the SaveMIME function, or by another e-mail client including Microsoft Outlook Express and Microsoft Mail.

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:

Set objSmtpServer          = CreateObject("ActiveXperts.SmtpServer") ' Create SmtpMail instance
Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")   ' Create SmtpMail instance
objSmtpMail.LoadMIME( "C:\File.mim" )
WScript.Echo "LoadMIME, result: " & objSmtpMail.LastError
...
objSmtpServer.Connect( "mailserver.company.intra" )
objSmtpServer.Send( objSmtpMail )
objSmtpServer.Disconnect()
...

SmtpMail.SaveMIME function

Description:

This function saves all properties, recipients and attachments to a MIME file. This MIME file can be used at any time by the LoadMIME function, or by another e-mail client including Microsoft Outlook Express and Microsoft Mail.

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:

Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")   ' Create SmtpMail instance
objSmtpMail.From           = "me@mydomain.com"
objSmtpMail.AddTo "john@company.com", "My Friend John"
objSmtpMail.Subject        = "This is my subject"
objSmtpMail.Body           = "This is my message to you"
objSmtpMail.AddAttachment "c:\temp\mypicture.jpg"
objSmtpMail.AddAttachment "c:\temp\mydocument.doc"
objSmtpMail.SaveMIME( "C:\File.mim" )
WScript.Echo "SaveMIME, result: " & objSmtpMail.LastError...

6. SmtpServer Object

6.1. SmtpServer Object - Introduction

The SmtpServer object can be used to connect to an SMTP server and sumbit one or more SmtpMail messages.
By default, port 25 is used to connect to the remote SMTP server. You can also specify an alternate port.

Send an e-mail message

The following sample shows how to send an e-mail:

Set objSmtpServer          = CreateObject("ActiveXperts.SmtpServer") ' Create SmtpServer object
Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")   ' Create SmtpMail object
objSmtpServer.Connect( "smtp.mydomain.com" )                         ' Establish connection
If( objSmtpServer.LastError = 0 ) Then
  objSmtpMail.FromAddress  = "sender@mydomain.com"                   ' From (e-mail address)
  objSmtpMail.FromName     = "ActiveEmail Demo"                      ' From (name)
  objSmtpMail.Subject      = "ActiveEmail Message"                   ' Subject
  objSmtpMail.Body         = "Hello, how are you?"                   ' Body
  objSmtpMail.AddTo "frank@myrecipients.com", "Frank"                ' Add a recipient

 objSmtpServer.Send( objSmtpMail )                                   ' Send mail now
 objSmtpServer.Disconnect                                            ' Disconnect
End If

6.2. SmtpServer Object - Overview of Properties and Functions

Type In/Out Mand/Opt Description
Version String Out n/a Product version number
ExpirationDate String Out n/a Product expiration date
HostPort Number In/Out O The TCP port of the SMTP server. Default: 25
Authentication Number In/Out O The preferred authentication mechanism
LastError Number Out n/a Result of a previously called Send or Queue function
LastSmtpResponse String Out n/a Reponse of the SMTP server on last e-mail operation
LogFile String In/Out O All SMTP commands and responses are logged to this file

Function Description
Clear Clear all properties
SetSecure Set mode to secure mode to allow secure SMTP communications
Connect Connect to an SMTP server
Disconnect Disconnect SMTP session
IsConnected Get connection status
Send Send an e-mail message
Queue Queue an e-mail message
GetErrorDescription Lookup error description of the given error code
Activate Activate the product

6.3. SmtpServer Object - Properties

SmtpServer.Version property

Type:

String

Description:

Version information of ActiveEmail. This property is read-only; you cannot assign a value to it.

Example:

Set objSmtpServer          = CreateObject("ActiveXperts.SmtpServer") ' Create SmtpServer object
WScript.Echo "Version: " & objSmtpServer.Version

SmtpServer.ExpirationDate property

Type:

String

Description:

Expiration date of ActiveEmail. This property is read-only; you cannot assign a value to it.
Once you have registered the product, the property holds the empty string value.

Example:

Set objSmtpServer          = CreateObject("ActiveXperts.SmtpServer") ' Create SmtpServer object
WScript.Echo "Version: " & objSmtpServer.ExpirationDate

SmtpServer.HostPort property

Type:

Number

Description:

The 'HostPort' property specifies the port used by the Connect function to connect to a remote SMTP server. If the remote SMTP server uses a different port than port 25 (default), you can specify it by assigning a value to this property.

Example:

Set objSmtpServer          = CreateObject("ActiveXperts.SmtpServer") ' Create SmtpServer instance
objSmtpServer.HostPort     = 7025                                    ' To specify an alternate port other than 25
objSmtpServer.Connect( "smtp.myserver.com" )                         ' Attempt to connect on port 7025

SmtpServer.Authentication property

Type:

Number

Description:

The 'Authentication' property specifies the mechanism used by the Connect function to authenticate to a remote SMTP server. By default, the ActiveEmail Toolkit uses auto-detection. For a list of valid authentication identifiers, click here.
NOTE: If you do not pass credentials to the Connect function (the 2nd and 3rd parameter of the function), the 'Authentication' property is ignored.

Example:

Set objSmtpServer          = CreateObject("ActiveXperts.SmtpServer") ' Create SmtpServer instance
Set objConstants           = CreateObject("ActiveXperts.EMailConstants")
...
objSmtpServer.Authentication = objConstants.asAUTH_SMTP_MD5CRAM      
objSmtpServer.Connect( "smtp.myserver.com", "userid", "passwd" )     ' Connect and authenticate using MD5/CRAM

SmtpServer.LastError property

Type:

Number

Description:

The result of a previously called function. Should be used to check the result of your last function call. All functions (methods) store the result into the 'LastError' property. The property is read-only; you cannot assign a value to it.

For more information about error codes, click here.

Example:

Set objSmtpServer          = CreateObject("ActiveXperts.SmtpServer") ' Create SmtpServer instance
objSmtpServer.Send( .. )
WScript.Echo "LastError: " & objSmtpServer.LastError

SmtpServer.LastSmtpResponse property

Type:

String

Description:

The last response of the SMTP server. The property is read-only; you cannot assign a value to it. The property can be very useful for troubleshooting purposes: when a mail fails, the information provided by the SMTP server can explain exactly what went wrong.

If you need more advanced trace information, try the LogFile property.

Example:

Set objSmtpServer          = CreateObject("ActiveXperts.SmtpServer") ' Create SmtpServer instance
objSmtpServer.Send
WScript.Echo "LastError: " & objSmtpServer.LastError
WScript.Echo "Response of SMTP Server: " & objSmtp.LastSmtpResponse  ' Last SMTP response

SmtpServer.LogFile property

Type:

String

Description:

By default, LogFile holds the empty string so nothing is logged. If you assign a valid file name to it, all commands and responses will be written to this log file.
Output data is written at the end of the file, the file is not cleared.

Example:

Set objSmtpServer          = CreateObject("ActiveXperts.SmtpServer") ' Create SmtpServer instance
objSmtpServer.LogFile      = "c:\temp\smtp.log"                      ' Specify the log file
objSmtpServer.Send( .. )

6.4. SmtpServer Object - Functions

SmtpServer.Clear function

Description:

This function resets all properties to the initial, default values.

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:

Set objSmtpServer       = CreateObject( "ActiveXperts.SmtpServer" )   ' Create SmtpServer instance
...
objSmtpServer.Send( .. )
...
objSmtpServer.Clear()
...
objSmtpServer.Send( .. )

SmtpServer.SetSecure function

Description:

To send an e-mail through a secure TLS/SSL SMTP server, you should call 'SetSecure' first. Some SMTP server only accept secure channels, such as gmail (smtp.gmail.com). This function must be called prior to a call to Connect.

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:

Set objSmtpServer          = CreateObject("ActiveXperts.SmtpServer") ' Create SmtpServer instance
Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")
objSmtpServer.SetSecure 465                                          ' Allow secure communications
objSmtpServer.Connect( "smtp.gmail.com", "activexperts", "topsecret" )
If( objSmtpServer.LastError = 0 ) Then
  objSmtpMail.From         = "activexperts@gmail.com"
  objSmtpMail.Subject      = "Message sent through gmail.com"
  ...
  objSmtpServer.Send
  objSmtpServer.Disconnect
End If

SmtpServer.Connect function

Description:

Connects to an SMTP server on port 25 (unless HostPort is set to a different port). After you've established a connection to the mail server, you can send one or more e-mail messages.
Call Disconnect to disconnect the session when you don't want to send any more messages.

There are a few different authentication mechanisms for SMTP. ActiveEmail auto-detects the way of authentication; if you want to force the toolkit to use a particular authentication mechanism, set the Authentication property before you call 'Connect'.

To connect to a secure SMTP server (e.g. smtp.gmail.com), you should call SetSecure first.

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example (no authentication):

Set objSmtpServer          = CreateObject("ActiveXperts.SmtpServer") ' Create SmtpServer instance
Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")
objSmtpServer.Connect( "smtp.domainname.com" )
If( objSmtpServer.LastError = 0 ) Then
  objSmtpMail.From         = "me@domainname.com"
  objSmtpMail.Subject      = "This is my subject"
  ...
  objSmtpServer.Send
  objSmtpServer.Disconnect
End If

Example (authentication required by SMTP server):

Set objSmtpServer          = CreateObject("ActiveXperts.SmtpServer") ' Create SmtpServer instance
Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")
objSmtpServer.Connect( "exchange.mydomain.com", "administrator", "mypassword" )
If( objSmtpServer.LastError = 0 ) Then
  objSmtpMail.From         = "me@mydomain.com"
  objSmtpMail.Subject      = "This is my subject"
  ...
  objSmtpServer.Send
  objSmtpServer.Disconnect
End If

SmtpServer.Disconnect function

Description:

After you've established a connection to the mail server, you can send one or more e-mail messages.
Call 'Disconnect' to disconnect the session.

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:

Set objSmtpServer          = CreateObject("ActiveXperts.SmtpServer") ' Create SmtpServer instance
objSmtpServer.Connect( "smtp.domainname.com" )
If( objSmtpServer.LastError = 0 ) Then
  ...
  objSmtp.Disconnect                                                 ' Disconnect
End If

SmtpServer.IsConnected function

Description:

This function returns True (-1) if the object has a connection to an SMTP server; otherwise, False (0) is returned.

Parameters:

Return value:

True (-1) or False (0).

Example:

Set objSmtpServer          = CreateObject("ActiveXperts.SmtpServer") ' Create SmtpServer instance
objSmtpServer.Connect( "smtp.domainname.com" )
WScript.Echo objSmtpServer.LastError
If( objSmtpServer.IsConnected() ) Then                               ' Is connected?
   WScript.Echo "Connected!"
Else
   WScript.Echo "Not connected"
End If

SmtpServer.Send function

Description:

This function sends a SMTP message directly to a SMTP server. You must first establish a connection to your mail server before you can call the 'Send' function.

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:

Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")   ' Create SmtpMail instance
Set objSmtpServer          = CreateObject("ActiveXperts.SmtpServer") ' Create SmtpServer instance
objSmtpServer.Connect( "smtp.domainname.com" )
If( objSmtpServer.LastError = 0 ) Then
  objSmtpMail.From         = "me@mydomain.com"
  objSmtpMail.AddTo "john@company.com", "My Friend John"
  objSmtpMail.Subject      = "This is my subject"
  ...
  objSmtpServer.Send( objSmtpMail )                                  ' Send mail
  objSmtpServer.Disconnect
End If

SmtpServer.Queue function

Description:

This function puts an SMTP message into the queue. The ActiveEmail Queue Service will pick it up and send it to the SMTP server.
You do NOT need to establish a conection to the mail server first (this is done by the ActiveEmail Queue Server service).

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:

Set objSmtpMail            = CreateObject("ActiveXperts.SmtpMail")   ' Create SmtpMail instance
Set objSmtpServer          = CreateObject("ActiveXperts.SmtpServer") ' Create SmtpServer instance
objSmtpMail.From           = "me@mydomain.com"
objSmtpMail.AddTo "john@company.com", "My Friend John"
objSmtpMail.Subject        = "This is my subject"
...
objSmtpServer.Queue( objSmtpMail, "smtp.domainname.com", False )

SmtpServer.GetErrorDescription function

Description:

Function to retrieve the explanation of an error code.

Parameters:

Return value:

The error string.

Example:

Set objSmtpServer = CreateObject( "ActiveXperts.SmtpServer" )
objSmtpServer.Send( .. )
If objSmtpServer.LastError <> 0 Then
  WScript.Echo "Error description: " & objSmtpServer.GetErrorDescription( objSmtpServer.LastError )
End If

SmtpServer.Activate function

Description:

This function activates the ActiveEmail product. A valid registration code should be passed as parameter.

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:

Set objSmtpServer          = CreateObject("ActiveXperts.SmtpServer") ' Create SmtpServer instance
objSmtpServer.Activate "xxxxx-xxxxx-xxxxx", True ' Use a valid registration code
                                            ' Pass True to make the activation persistent, so you need
                                            ' to call Activate only once. If you pass False, you need to call Activate  
                                            ' each time the product is started.

7. Pop3Mail Object

7.1. Pop3Mail Object - Introduction

The Pop3Mail object holds all properties of a POP3 message, like: recipients, subject, body, priority, attachments, etc..

Use Pop3Mail object to send an e-mail

The following sample demonstrates the use of the 'Pop3Mail' object (sample written in VBScript).

Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" )          ' Create Pop3Server object
objPop3Server.Connect( "pop3.mydomain.com", "userid", "passwd" )       ' Connect to the POP3 server, and login using
                                                                       ' account 'userid', password 'passwd'
If( objPop3Server.LastError = 0 AND objPop3Server.CountMessages() > 0 ) Then 
   Set objPop3Mail = objPop3Server.GetEmail( 1 )                       ' Retrieve the first message (Message ID:1)
   If( objPop3Server.LastError = 0 ) Then                        
      WScript.Echo "MessageID       : " & objPop3Mail.ID               ' Show e-mail information
      WScript.Echo "  Size          : " & objPop3Mail.Size
      WScript.Echo "  FromAddress   : " & objPop3Mail.FromAddress
      WScript.Echo "  FromName      : " & objPop3Mail.FromName
      WScript.Echo "  Organization  : " & objPop3Mail.Organization
      WScript.Echo "  Reply Address : " & objPop3Mail.ReplyAddress	
      WScript.Echo "  Read Receipt Address : " & objPop3Mail.ReadReceiptAddress	
      WScript.Echo "  ToAddress     : " & objPop3Mail.ToAddress
      WScript.Echo "  CcAddress     : " & objPop3Mail.CcAddress
      WScript.Echo "  Priority      : " & objPop3Mail.Priority
      WScript.Echo "  Date          : " & objPop3Mail.Date
      WScript.Echo "  Subject       : " & objPop3Mail.Subject
      WScript.Echo "  BodyType      : " & objPop3Mail.BodyType
      WScript.Echo "  Body          : " & Left ( objPop3Mail.Body, InStr ( objPop3Mail.Body, vbCrLf ) )
      WScript.Echo "  Attachments   : " & objPop3Mail.CountAttachments & vbCrLf

      numAttachments = objPop3Mail.CountAttachments 
      For i = 1 to numAttachments                                      ' Iterate over all attachments
         WScript.Echo "Attachment Name : " & objPop3Mail.GetAttachmentName(i)
         WScript.Echo "Attachment Size : " & objPop3Mail.GetAttachmentSize(i)

         ' NOTE: attachments can be saved using the 'SaveAttachment' function
      Next
   End If
End If

objPop3Server.Disconnect                                               ' Disconnect

7.2. Pop3Mail Object - Overview of Properties and Functions

Property Type In/Out Mand/Opt Description
ID Number Out n/a The message ID
Size Number Out n/a The size (in bytes) of the message
FromAddress String Out n/a The sender's e-mail address
FromName String Out n/a The sender's name
Organization String Out n/a The sender's organization name
ReplyAddress String Out n/a The sender's reply-address
ReadReceiptAddress String Out n/a The read receipt e-mail address
ToAddress String Out n/a The recipient's e-mail address
CcAddress String Out n/a The recipient's CC address
Date String Out n/a The date and time the message was sent by the sender
Encoding Number Out n/a The encoding that was used, for instance: Japanese or Chinese
Subject String Out n/a The subject of the message
Priority Number Out n/a The priority of the message. There a five different priority-levels
BodyType Number Out n/a The bodytype of the message
Body String Out n/a The body of the message
Hash String Out n/a A hash of the message header
LastError Number Out n/a Result of a previously called function

Function Description
Clear Clear all properties
CountAttachments Count the number of attachments in the e-mail
GetAttachmentName Get the plain file name of the attachment as it was sent by the sender
GetAttachmentSize Get the size (bytes) of the attachment
SaveAttachment Save an attachment
SaveMIME Save properties, recipients and attachments to a MIME file

7.3. Pop3Mail Object - Properties

Pop3Mail.ID property

Type:

Number

Description:

The Message ID of the POP3 message. This ID is greater or equal to 1 and less or equal than CountMessages.

Example:

Set objPop3Mail            = CreateObject("ActiveXperts.Pop3Mail")   ' Create Pop3Mail instance
Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
    ...
WScript.Echo "MessageID : " & objPop3Mail.ID                         ' Show Message ID
...

Pop3Mail.Size property

Type:

Number

Description:

The size (in bytes) of the POP3 message.

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
...
WScript.Echo "Size : " & objPop3Mail.Size & " (bytes)"               ' Show message size (in bytes)
...

Pop3Mail.FromAddress,
Pop3Mail.FromName properties

Type:

String

Description:

The FromAddress and FromName fields specify the sender. The FromAddress specifies the sender's e-mail address. This is the return-path for your e-mail, unless you specify the ReplyAddress property. The ReplyAddress property always overrides the FromAddress property for it's return path. The FromName field specifies the sender's friendly name.

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
    ...
WScript.Echo "From (e-mail) : " & objPop3Mail.FromAddress            ' Show from (e-mail address)
WScript.Echo "From (name) : "   & objPop3Mail.FromName               ' Show from (friendly name)
...

Pop3Mail.Organization property

Type:

String

Description:

The sender's organization name.

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
...
WScript.Echo "From (organization) : " & objPop3Mail.Organization     ' Show sender's organization name
...

Pop3Mail.ReplyAddress property

Type:

String

Description:

The Reply-address of the sender. If not specified, the reply-address will be the address indicated by the FromAddress property.

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
...
WScript.Echo "Reply-address : " & objPop3Mail.ReplyAddress           ' Show sender's reply address
...

Pop3Mail.ReadReceiptAddress property

Type:

String

Description:

E-mail address of the person who should receive a 'read receipt'.

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
...
WScript.Echo "Read receipt : " & objPop3Mail.ReadReceiptAddress      ' Show sender's read receipt address
...

Pop3Mail.ToAddress property

Type:

String

Description:

The destination e-mail address. This can also be a list of e-mail addresses (separated by a semi-column).

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
...
WScript.Echo "To recipient(s) : " & objPop3Mail.ToAddress            ' Show recipient's 'To' address(es)
...

Pop3Mail.CcAddress property

Type:

String

Description:

The destination CC e-mail address. This can also be a list of e-mail addresses (separated by a semi-column).

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
...
WScript.Echo "CC recipient(s) : " & objPop3Mail.CcAddress            ' Show recipient's 'CC' address(es)
...

Pop3Mail.Date property

Type:

String

Description:

The date and time the message was sent by the sender.

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
...
WScript.Echo "Date : " & objPop3Mail.Date                            ' Show Date property
...

Pop3Mail.Encoding property

Type:

Number

Description:

For a list of valid encoding values, click here.

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
...
WScript.Echo "Encoding : " & objPop3Mail.Encoding                    ' Show Encoding property
...

Pop3Mail.Subject property

Type:

String

Description:

The Subject of a message. Not mandatory.

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
...
WScript.Echo "Subject : " & objPop3Mail.Subject                      ' Show Subject property
...

Pop3Mail.Priority property

Type:

Number

Description:

The Priority of the message. There are 5 priority levels, described here.

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
...
WScript.Echo "Priority : " & objPop3Mail.Priority                    ' Show Priority property
...

Pop3Mail.BodyType
Pop3Mail.Body properties

Type:

Number, String

Description:

Two body formats are supported by ActiveEmail:

A message body in Plain Text format doesn't support any formatting capabilities; it doesn't support embedded objects either.
A message body in HTML format supports HTML text formatting tags, as well as embedded objects like images and sounds.

There are two values for the BodyType:

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
...
WScript.Echo "BodyType : " & objPop3Mail.BodyType                    ' Show BodyType property
WScript.Echo "Body (first 100 chars):" & Left(objPop3Mail.Body, 100) ' Show first 100 characters of the body
...

Pop3Mail.Hash property

Type:

String

Description:

The Hash value of the e-mail header. It's a unique number for an e-mail message

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
...
WScript.Echo "Hash : " & objPop3Mail.Hash                            ' Show Hash property
...

Pop3Mail.LastError property

Type:

Number

Description:

This read-only property indicates the result of the last called function. You should always checks the result of your functions. A zero indicates: success. Any non-zero value means an error.
For a complete list of error codes, check out the following page: www.activexperts.com/support/errorcodes.

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
...
WScript.Echo "#Attachments" & objPop3Mail.CountAttachments()         
objPop3Mail.SaveAttachment( 10, "c:\temp\attach100.bin" )            ' Save 10th attachment.
WScript.Echo "SaveAttachment, result: " & objPop3Mail.LastError
...

7.4. Pop3Mail Object - Functions

Pop3Mail.Clear function

Description:

This function resets all Properties to the initial, default values.

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
...
WScript.Echo "Subject : " & objPop3Mail.Subject                      ' Show Subject property
objPop3Mail.Clear()                                                  ' Clear all properties
WScript.Echo "Subject : " & objPop3Mail.Subject                      ' Will show an empty string

Pop3Mail.CountAttachments function

Description:

Returns the number of attachments in a POP3 message.

Parameters:

Return value:

The number of attachments. If the function fails, 0 is returned an the error code is stored in the LastError property.

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
WScript.Echo "#Attachments : " & objPop3Mail.CountAttachments()      ' Show the number of attachments
...

Pop3Mail.GetAttachmentName function

Description:

Returns the name of the attached file as it was sent by the sender.

Parameters:

Return value:

The name of the attached file. If the function fails, 0 is returned an the error code is stored in the LastError property.

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
For i = 1 To objPop3Mail.CountAttachments()
   WScript.Echo "Attachm. name:" & objPop3Mail.GetAttachmentName(i)  ' Show the name of the attachment
Next
...

Pop3Mail.GetAttachmentSize function

Description:

Returns the size of the attached file.

Parameters:

Return value:

The size of the attached file. If the function fails, 0 is returned an the error code is stored in the LastError property.

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
For i = 1 To objPop3Mail.CountAttachments()
   WScript.Echo "Attachm. size:" & objPop3Mail.GetAttachmentSize(i)  ' Show the size of the attachment
Next
...

Pop3Mail.SaveAttachment function

Description:

Saves an attached file to save location.

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
...
For i = 1 To objPop3Mail.CountAttachments()
  strSaveAs = "c:\temp\" & objPop3Mail.GetAttachmentName(i)
  objPop3Mail.SaveAttachment( i, strSaveAs )                         ' Save attachment
  WScript.Echo "Attachment saved as " & strSaveAs & ", result: " & objPop3Mail.LastError
Next

Pop3Mail.SaveMIME function

Description:

This function saves all properties, recipients and attachments to a MIME file. This MIME file can be used at any time by the LoadMIME function, or by another e-mail client including Microsoft Outlook Express and Microsoft Mail.

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:

Set objPop3Mail            = objPop3Server.GetEmail( 1 )             ' Retrieve the first message (Message ID:1)
objPop3Mail.SaveMIME( "C:\File.mim" )                                ' Save MIME file
WScript.Echo "SaveMIME, result: " & objPop3Mail.LastError            ' Show the result
...

8. Pop3Server Object

8.1. Pop3Server Object - Introduction

The Pop3Server object can be used to connect to an POP3 server and sumbit one or more Pop3Mail messages.
By default, port 110 is used to connect to the remote POP3 server. You can also specify an alternate port.

Show the top 3 messages in a mailbox

The following sample shows how to show the top 3 messages in a specific mailbox:

Set objPop3Server = CreateObject("ActiveXperts.Pop3Server")          ' Create Pop3Server object
objPop3Server.Connect "pop3.mydomain.com", "userid", "passwd"        ' Connect to the POP3 server, and login using
                                                                     ' account 'userid', password 'passwd'
If( objPop3Server.LastError = 0 ) Then 
  numMessages = objPop3Server.CountMessages()                        ' Count the messages in the mailbox
  WScript.Echo numMessages & " new message(s) in mailbox."
  For i = 1 to 3                                                     ' Iterate over the first 3 messages in the mailbox
    Set objPop3Mail = objPop3Server.GetEmailMessage( i )             ' Get e-mail
    If ( objPop3Server.LastError = 0 ) Then                          ' If message does exist then show details

      WScript.Echo "MessageID       : " & objPop3Mail.ID             ' Show e-mail information
      WScript.Echo "  Size          : " & objPop3Mail.Size
      WScript.Echo "  FromAddress   : " & objPop3Mail.FromAddress
      WScript.Echo "  FromName      : " & objPop3Mail.FromName
      WScript.Echo "  Organization  : " & objPop3Mail.Organization
      WScript.Echo "  Reply Address : " & objPop3Mail.ReplyAddress	
      WScript.Echo "  Read Receipt Address : " & objPop3Mail.ReadReceiptAddress	
      WScript.Echo "  ToAddress     : " & objPop3Mail.ToAddress
      WScript.Echo "  CcAddress     : " & objPop3Mail.CcAddress
      WScript.Echo "  Priority      : " & objPop3Mail.Priority
      WScript.Echo "  Date          : " & objPop3Mail.Date
      WScript.Echo "  Subject       : " & objPop3Mail.Subject
      WScript.Echo "  BodyType      : " & objPop3Mail.BodyType
      WScript.Echo "  Body          : " & Left ( objPop3Mail.Body, InStr ( objPop3Mail.Body, vbCrLf ) )
      WScript.Echo "  Attachments   : " & objPop3Mail.CountAttachments & vbCrLf

      numAttachments = objPop3Mail.CountAttachments 
      For j = 1 to numAttachments                                    ' Iterate over all attachments
        WScript.Echo "Attachment Name : " & objPop3Mail.GetAttachmentName(j)
        WScript.Echo "Attachment Size : " & objPop3Mail.GetAttachmentSize(j)

        ' NOTE: attachments can be saved using the 'SaveAttachment' function
      Next
    End If
  Next
  objPop3Server.Disconnect                                           ' Disconnect
End If
List all e-mail headers of a mailbox

The following sample shows how to list all e-mail headers in a specific mailbox:

Set objPop3Server = CreateObject( "ActiveXperts.Pop3Server" )        ' Create Pop3Server object
objPop3Server.Connect "pop3.mydomain.com", "userid", "passwd"        ' Connect to the POP3 server, and login using
                                                                     ' account 'userid', password 'passwd'
If( objPop3Server.LastError = 0 ) Then 
  numMessages = objPop3Server.CountMessages()                        ' Count the messages in the mailbox
  WScript.Echo numMessages & " new message(s) in mailbox."
  For i = 1 to numMessages                                           ' Iterate over all messages in the mailbox
    Set objPop3Mail = objPop3Server.GetEmailHeader( i )              ' Get the header of the particular e-mail
    If ( objPop3Server.LastError = 0 ) Then                        
      WScript.Echo "MessageID       : " & objPop3Mail.ID             ' Show header information
      WScript.Echo "  Size          : " & objPop3Mail.Size
      WScript.Echo "  FromAddress   : " & objPop3Mail.FromAddress
      WScript.Echo "  FromName      : " & objPop3Mail.FromName
      WScript.Echo "  Organization  : " & objPop3Mail.Organization
      WScript.Echo "  Reply Address : " & objPop3Mail.ReplyAddress	
      WScript.Echo "  Read Receipt Address : " & objPop3Mail.ReadReceiptAddress	
      WScript.Echo "  ToAddress     : " & objPop3Mail.ToAddress
      WScript.Echo "  CcAddress     : " & objPop3Mail.CcAddress
      WScript.Echo "  Priority      : " & objPop3Mail.Priority
      WScript.Echo "  Date          : " & objPop3Mail.Date
      WScript.Echo "  Subject       : " & objPop3Mail.Subject
      WScript.Echo "  BodyType      : " & objPop3Mail.BodyType

      ' To retrieve the Body and the Attachments, use 'GetEmailMessage'
    End If
  Next
  objPop3Server.Disconnect                                           ' Disconnect
End If

8.2. Pop3Server Object - Overview of Properties and Functions

Type In/Out Mand/Opt Description
Version String Out n/a Product version number
ExpirationDate String Out n/a Product expiration date
HostPort Number In/Out O The TCP port of the POP3 server. Default: 110
Authentication Number In/Out O The preferred authentication mechanism
Timeout Number In/Out O The timeout used when retrieving data
LastError Number Out n/a Result of a previously called Send or Queue function
LastPop3Response String Out n/a Reponse of the POP3 server on last e-mail operation
LogFile String In/Out O All POP3 commands and responses are logged to this file

Function Description
Clear Clear all properties
SetSecure Set mode to secure mode to allow secure POP3 communications
Connect Connect to an POP3 server
Disconnect Disconnect POP3 session
IsConnected Get connection status
CountMessages Count messages in the current mailbox
GetEmailHeader Get the header of a specific message in the mailbox
GetEmailMessage Get the e-mail
DeleteMessage Delete a specific message from the mailbox
GetErrorDescription Lookup error description of the given error code
Activate Activate the product

8.3. Pop3Server Object - Properties

Pop3Server.Version property

Type:

String

Description:

Version information of ActiveEmail. This property is read-only; you cannot assign a value to it.

Example:

Set objPop3Server          = CreateObject("ActiveXperts.Pop3Server") ' Create Pop3Server object
WScript.Echo "Version: " & objPop3Server.Version

Pop3Server.ExpirationDate property

Type:

String

Description:

Expiration date of ActiveEmail. This property is read-only; you cannot assign a value to it.
Once you have registered the product, the property holds the empty string value.

Example:

Set objPop3Server          = CreateObject("ActiveXperts.Pop3Server") ' Create Pop3Server object
WScript.Echo "Version: " & objPop3Server.ExpirationDate

Pop3Server.HostPort property

Type:

Number

Description:

The 'HostPort' property specifies the port used by the Connect function to connect to a remote POP3 server. If the remote POP3 server uses a different port than port 110 (default), you can specify it by assigning a value to this property.

Example:

Set objPop3Server          = CreateObject("ActiveXperts.Pop3Server")  ' Create Pop3Server instance
objPop3Server.HostPort     = 8010                                     ' To specify an alternate port other than 110
objPop3Server.Connect( "smtp.myserver.com" )                          ' Attempt to connect on port 8010

Pop3Server.Authentication property

Type:

Number

Description:

The 'Authentication' property specifies the mechanism used by the Connect function to authenticate to a remote POP3 server. By default, the ActiveEmail Toolkit uses auto-detection. For a list of valid authentication identifiers, click here.

Example:

Set objPop3Server          = CreateObject("ActiveXperts.Pop3Server") ' Create Pop3Server instance
Set objConstants           = CreateObject("ActiveXperts.EMailConstants")
...
objPop3Server.Authentication = objConstants.asAUTH_POP3_APOP      
objPop3Server.Connect( "pop3.myserver.com", "userid", "passwd" )     ' Connect and authenticate using APOP
...

Pop3Server.Timeout property

Type:

Number

Description:

The 'Timeout' property indicates the timeout used when retrieving data, in seconds. Default: 60 seconds. This property should suffice in most circumstances. Please note that a virus scanner will first dowload and check the body and attachment database before it will actually delivered the data to ActiveEmail. With a slow internet connection, you may need to increase the 'Timeout' property.

Example:

Set objPop3Server          = CreateObject("ActiveXperts.Pop3Server") ' Create Pop3Server instance
...    
objPop3Server.Timeout = 300                                          ' Connect and authenticate using APOP
...

Pop3Server.LastError property

Type:

Number

Description:

The result of a previously called function. Should be used to check the result of your last function call. All functions (methods) store the result into the 'LastError' property. The property is read-only; you cannot assign a value to it.

The GetErrorDescription function provides the error description of an error code.
For more information about error codes, click here.

Example:

Set objPop3Server          = CreateObject("ActiveXperts.Pop3Server") ' Create Pop3Server instance
objPop3Server.GetEmailHeader( 1 )
WScript.Echo "LastError: " & objPop3Server.LastError
WScript.Echo "Result description: " & objPop3Server.GetErrorDescription( objPop3Server.LastError )

Pop3Server.LastPop3Response property

Type:

String

Description:

The last response of the POP3 server. The property is read-only; you cannot assign a value to it. The property can be very useful for troubleshooting purposes: when a mail fails, the information provided by the POP3 server can explain exactly what went wrong.

If you need more advanced trace information, try the LogFile property.

Example:

Set objPop3Server          = CreateObject("ActiveXperts.Pop3Server") ' Create Pop3Server instance
objPop3Server.GetEmailHeader( 1 )
WScript.Echo "LastError: " & objPop3Server.LastError
WScript.Echo "Response of POP3 Server: " & objPop3.LastPop3Response  ' Last POP3 response

Pop3Server.LogFile property

Type:

String

Description:

By default, LogFile holds the empty string so nothing is logged. If you assign a valid file name to it, all commands and responses will be written to this log file.
Output data is written at the end of the file, the file is not cleared.

Example:

Set objPop3Server          = CreateObject("ActiveXperts.Pop3Server") ' Create Pop3Server instance
objPop3Server.LogFile      = "c:\temp\smtp.log"                      ' Specify the log file
objPop3Server.Send( .. )

8.4. Pop3Server Object - Functions

Pop3Server.Clear function

Description:

This function resets all properties to the initial, default values.

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:

Set objPop3Server          = CreateObject("ActiveXperts.Pop3Server") ' Create Pop3Server instance
...
objPop3Server.HostPort     = 9110
...
objPop3Server.Clear()
WScript.Echo objPop3Server.HostPort                                  ' Will display: 110

Pop3Server.SetSecure function

Description:

To receive an e-mail through a secure TLS/SSL Pop3 server, you should call 'SetSecure' first. Some Pop3 servers only accept secure channels, such as gmail (pop.gmail.com). This function must be called prior to a call to Connect.

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:

Set objPop3Server          = CreateObject("ActiveXperts.Pop3Server") ' Create Pop3Server instance
Set objPop3Mail            = CreateObject("ActiveXperts.Pop3Mail")
objPop3Server.SetSecure 995                                          ' Allow secure communications
objPop3Server.Connect("pop.gmail.com", "activexperts", "topsecret")  ' Connect to the secure POP3 server, and login using
                                                                     ' account 'userid', password 'passwd'
If( objPop3Server.LastError = 0 ) Then 
   numMessages = objPop3Server.CountMessages()                       ' Count the messages in the mailbox
   WScript.Echo numMessages & " new message(s) in mailbox."
   objPop3Server.Disconnect                                          ' Disconnect
End If

Pop3Server.Connect function

Description:

Connect to an POP3 server on port 110 (unless HostPort is set to a different port) and open a mailbox. After you've established a connection to the mail server, you can receive e-mail messages.
Call Disconnect to disconnect the session after you finished receiving the messages.

A POP3 mailbox requires authentication, so you must specify an user-id and a password as additional parameters.
There are a few different authentication mechanisms for POP3. ActiveEmail auto-detects the way of authentication; if you want to force the toolkit to use a particular authentication mechanism, set the Authentication property before you call 'Connect'.

To connect to a secure POP3 server (e.g. pop.gmail.com), you should call SetSecure first.

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:

Set objPop3Server          = CreateObject("ActiveXperts.Pop3Server") ' Create Pop3Server instance
objPop3Server.Connect( "pop3.mydomain.com", "userid", "passwd" )     ' Connect to the POP3 server, and login using
                                                                     ' account 'userid', password 'passwd'
If( objPop3Server.LastError = 0 ) Then 
   numMessages = objPop3Server.CountMessages()                       ' Count the messages in the mailbox
   WScript.Echo numMessages & " new message(s) in mailbox."
   objPop3Server.Disconnect                                          ' Disconnect
End If

Pop3Server.Disconnect function

Description:

After you've established a connection to the POP3 server, you can receive e-mail messages.
Call 'Disconnect' to disconnect the session.

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:

Set objPop3Server          = CreateObject("ActiveXperts.Pop3Server") ' Create Pop3Server instance
objPop3Server.Connect( "pop3.mydomain.com", "userid", "passwd" )     
If( objPop3Server.LastError = 0 ) Then
  ...
  objPop3.Disconnect                                                 ' Disconnect
End If

Pop3Server.IsConnected function

Description:

This function returns True (-1) if the object has a connection to an POP3 server; otherwise, False (0) is returned.

Parameters:

Return value:

True (-1) or False (0).

Example:

Set objPop3Server          = CreateObject("ActiveXperts.Pop3Server") ' Create Pop3Server instance
objPop3Server.Connect( "pop3.mydomain.com", "userid", "passwd" )
WScript.Echo objPop3Server.LastError
If( objPop3Server.IsConnected() Then )                               ' Is connected?
   WScript.Echo "Connected!"
Else
   WScript.Echo "Not connected"
End If
...

Pop3Server.CountMessages function

Description:

This function counts the number of messages in the current mailbox. You must first call the Connect function to open a mailbox on the POP3 server.

Parameters:

Return value:

The number of messages in the mailbox. If the function fails, 0 is returned and the LastError is set.

Example:

Set objPop3Server          = CreateObject("ActiveXperts.Pop3Server") ' Create Pop3Server instance
objPop3Server.Connect( "pop3.mydomain.com", "userid", "passwd" ) 
If( objPop3Server.LastError = 0 ) Then
   numMessages = objPop3Server.CountMessages()                       ' Count the messages in the mailbox
   WScript.Echo numMessages & " new message(s) in mailbox."
   objPop3Server.Disconnect
End If  

Pop3Server.GetEmailHeader function

Description:

This function retrieves the header of the e-mail. If the function completes successfully, a Pop3Mail object is returned with all properties filled except the body and the attachments. You must first call the Connect function to open a mailbox on the POP3 server.

Parameters:

Return value:

A new Pop3Mail object (or NULL if the function fails). Check LastError property to see if the function completed successfully.

Example:

Set objPop3Server          = CreateObject("ActiveXperts.Pop3Server") ' Create Pop3Server instance
objPop3Server.Connect( "pop3.mydomain.com", "userid", "passwd" )
If( objPop3Server.LastError = 0 ) Then
  If( objPop3Server.CountMessages() > 0 ) Then
    Set objPop3Mail = objPop3Server.GetEmailHeader( 1 )              ' Get header of the e-mail (ID:1)
    If ( objPop3Server.LastError = 0 ) Then                        
      WScript.Echo "MessageID       : " & objPop3Mail.ID             ' Show header information
      WScript.Echo "  Size          : " & objPop3Mail.Size
      WScript.Echo "  FromAddress   : " & objPop3Mail.FromAddress
      WScript.Echo "  FromName      : " & objPop3Mail.FromName
      WScript.Echo "  Organization  : " & objPop3Mail.Organization
      WScript.Echo "  Reply Address : " & objPop3Mail.ReplyAddress	
      WScript.Echo "  Read Receipt Address : " & objPop3Mail.ReadReceiptAddress	
      WScript.Echo "  ToAddress     : " & objPop3Mail.ToAddress
      WScript.Echo "  CcAddress     : " & objPop3Mail.CcAddress
      WScript.Echo "  Priority      : " & objPop3Mail.Priority
      WScript.Echo "  Date          : " & objPop3Mail.Date
      WScript.Echo "  Subject       : " & objPop3Mail.Subject
      WScript.Echo "  BodyType      : " & objPop3Mail.BodyType
    End If
    objPop3Server.Disconnect                                          
  End If
End If 

Pop3Server.GetEmailMessage function

Description:

This function retrieves the header of the e-mail. If the function completes successfully, a Pop3Mail object is returned with all properties filled.
a You must first call the Connect function to open a mailbox on the POP3 server.

Parameters:

Return value:

A new Pop3Mail object (or NULL if the function fails). Check LastError property to see if the function completed successfully.

Example:

Set objPop3Server          = CreateObject("ActiveXperts.Pop3Server") ' Create Pop3Server instance
objPop3Server.Connect( "pop3.mydomain.com", "userid", "passwd" )
If( objPop3Server.LastError = 0 ) Then
  If( objPop3Server.CountMessages() > 0 ) Then
    Set objPop3Mail = objPop3Server.GetEmailMessage( 1 )             ' Get header of the e-mail (ID:1)
    If ( objPop3Server.LastError = 0 ) Then                        
      WScript.Echo "MessageID       : " & objPop3Mail.ID             ' Show header information
      WScript.Echo "  Size          : " & objPop3Mail.Size
      WScript.Echo "  FromAddress   : " & objPop3Mail.FromAddress
      WScript.Echo "  FromName      : " & objPop3Mail.FromName
      WScript.Echo "  Organization  : " & objPop3Mail.Organization
      WScript.Echo "  Reply Address : " & objPop3Mail.ReplyAddress	
      WScript.Echo "  Read Receipt Address : " & objPop3Mail.ReadReceiptAddress	
      WScript.Echo "  ToAddress     : " & objPop3Mail.ToAddress
      WScript.Echo "  CcAddress     : " & objPop3Mail.CcAddress
      WScript.Echo "  Priority      : " & objPop3Mail.Priority
      WScript.Echo "  Date          : " & objPop3Mail.Date
      WScript.Echo "  Subject       : " & objPop3Mail.Subject
      WScript.Echo "  BodyType      : " & objPop3Mail.BodyType
    
      numAttachments = objPop3Mail.CountAttachments 
      For i = 1 to numAttachments                                    ' Iterate over all attachments
        WScript.Echo "Attachment Name : " & objPop3Mail.GetAttachmentName(i)
        WScript.Echo "Attachment Size : " & objPop3Mail.GetAttachmentSize(i)

        ' NOTE: attachments can be saved using the 'SaveAttachment' function
      Next      
    End If
    objPop3Server.Disconnect                                          
  End If
End If 

Pop3Server.DeleteMessage function

Description:

This function deletes a particular message from the mailbox. You must first call the Connect function to open a mailbox on the POP3 server.

Parameters:

Return value:

Always 0. Check LastError property to see if the function completed successfully.

Example:

Set objPop3Server          = CreateObject("ActiveXperts.Pop3Server") ' Create Pop3Server instance
objPop3Server.Connect( "pop3.mydomain.com", "userid", "passwd" )
If( objPop3Server.LastError = 0 ) Then
  If( objPop3Server.CountMessages() > 0 ) Then
    objPop3Server.DeleteMessage( 1 )                                 ' Delete particular e-mail (Message ID:1)
    If ( objPop3Server.LastError = 0 ) Then 
      WScript.Echo "Message successfully deleted."
    Else                       
      WScript.Echo "Message not deleted."
    End If
    objPop3Server.Disconnect                                          
  End If
End If

Pop3Server.GetErrorDescription function

Description:

Function to retrieve the explanation of an error code.

Parameters:

Return value:

The error string.

Example:

objPop3Server.Connect( "pop3.mydomain.com", "userid", "passwd" )
WScript.Echo "Connect, result (numeric): " & objPop3Server.LastError
WScript.Echo "Connect, result (string) : " & objPop3Server.GetErrorDescription( objPop3Server.LastError )

Pop3Server.Activate function

Description:

This function activates the ActiveEmail product. A valid registration code should be passed as parameter.

Parameters:

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:

Set objPop3Server          = CreateObject("ActiveXperts.Pop3Server") ' Create Pop3Server instance
objPop3Server.Activate "xxxxx-xxxxx-xxxxx", True ' Use a valid registration code
                                            ' Pass True to make the activation persistent, so you need
                                            ' to call Activate only once. If you pass False, you need to call Activate  
                                            ' each time the product is started.

9. ActiveEmail Queue Server

9.1. Introduction

With ActiveEmail, people usually send SMTP messages directly to an SMTP server. There are two drawbacks of sending directly to the SMTP server:

ActiveEmail can overcome these problems, using a queue mechanism: the client application/script connects to a network share service and drops the e-mail mime information in a file, and the control in the script or application is relinguished immediately.
The ActiveEmail Queue Service picks up the mime information from the network share and sends the e-mail(s) to the smtp server.
To make use of queuing, the should call the Queue function instead of the Send function.
The ActiveEmail Queue Service has enhanced logging capabilities.

The Queue is just a directory. If you use ActiveEmail on one machine only, it can be just a local directory. If you use ActiveEmail on more than one machine, the directory must be a shared directory, somewhere on the network.

You don't need an extra license to use the ActiveEmail Queue Server; licensing is only based on the number of PCs where the ActiveEmail COM component is registered.

The installation of the ActiveEmail Queue Server service creates some subdirectories in the installation directory of ActiveEmail:


9.2. Hosting the ActiveEmail Queue

The ActiveEmail Queue Service is not installed by default. To install the ActiveEmail Queue Server service, you must do the following:


9.3. Connecting to an ActiveEmail Queue Server from any network computer

Once you have configured one of your network server as 'ActiveEmail Queue Server', you can connect to it from other network computers. These computer must have ActiveEmail installed. To connect to an ActiveEmail Queue Server, you must do the following:


9.4. ActivQueue Configuration Settings

All configuration settings are made in the HKEY_LOCALMACHINE\Software\ActiveXperts\ActiveEmail key of the registry. Use REGEDT32.EXE to make changes to the registry.

The following settings are defined:

Registry Value Type Explanation
LogDir REG_SZ Directory where logfiles are stored. Emails are only logged if EnableLogging is set to 1 (default).
EnableLogging REG_DWORD Logging is enabled if this value is set to 1 (default). Log files are located in the LogDir directory.
PickupMailDir REG_SZ The 'ActiveEmail Queue Service' can service more than one client. There's one central directory where it can pickup it's e-mails. PickupMailDir points to this directory.
KeepFailedMails REG_DWORD In case of 0, a failed e-mail will be removed from the PickupMailDir directory. In case of 1, a failed e-mail will be moved from the PickupMailDir directory to the FailedMailDir directory.
FailedMailDir REG_SZ A failed e-mail will be moved to this directory, but only if KeepFailedMails is 1.
KeepSentMails REG_DWORD In case of 0, a sent e-mail will be removed from the PickupMailDir directory. In case of 1, a sent e-mail will be moved from the PickupMailDir directory to the SentMailDir directory.
SentMailDir REG_SZ A sent e-mail will be moved to this directory, but only if KeepSentMails is 1.

NOTE: You must restart the ActiveEmail Queue Service after you change the configuration parameters in the registry!


9.5. Errors and Warnings

All information about particalr e-mails are logged in the logdirectory (unless logging is disabled). Information about the ActiveEmail Queue Service itself, is logged in the Windows Event Log.
This information can be viewed by using the Event Viewer.
All errors and warnings are logged in the Application Log in the Event Log. So, if the service doesn't start, or e-mails are not logged, check out the Application Log using the Event Viewer.

10. ActiveEmail Constants and Error Codes

10.1. Constants

In ActiveEmail, all constants are grouped together in a separate object called EMailConstants. You must first create the Constants object before you can actually use constants:

Set objConstants = CreateObject( "ActiveXperts.EMailConstants" )
WScript.Echo objConstants.asMESSAGE_BODY_PLAIN
WScript.Echo objConstants.asMESSAGE_BODY_HTML
...
WScript.Echo objConstants.asMESSAGE_PRIORITY_HIGHEST
WScript.Echo objConstants.asMESSAGE_PRIORITY_HIGH
WScript.Echo objConstants.asMESSAGE_PRIORITY_MEDIUM
WScript.Echo objConstants.asMESSAGE_PRIORITY_LOW
WScript.Echo objConstants.asMESSAGE_PRIORITY_LOWEST
...

10.1.1. Format Values

Name Description
asMESSAGE_BODY_PLAIN Plain message body (default)
asMESSAGE_BODY_HTML Message body supports HTML tags

10.1.2. Priority Values

Name Description
asMESSAGE_PRIORITY_HIGHEST Highest priority
asMESSAGE_PRIORITY_HIGH High priority
asMESSAGE_PRIORITY_MEDIUM Normal priority (default)
asMESSAGE_PRIORITY_LOW Low priority
asMESSAGE_PRIORITY_LOWEST Lowest priority

10.1.3. Encoding Values

Name Description
asMESSAGE_ENCODING_DEFAULT Default encoding. Uses the Operating System's current codepage
asMESSAGE_ENCODING_THAI ISO-8859-11 encoding
asMESSAGE_ENCODING_JAPANESE ISO-2022-jp encoding
asMESSAGE_ENCODING_CHINESE_SIMP GB2312 encoding
asMESSAGE_ENCODING_KOREAN KSC-5601 encoding
asMESSAGE_ENCODING_CHINESE_TRAD BIG5 encoding
asMESSAGE_ENCODING_CENTRALEUROPE ISO-8859-2 encoding
asMESSAGE_ENCODING_RUSSIAN ISO-8859-5 encoding
asMESSAGE_ENCODING_WESTERN ISO-8859-1 encoding
asMESSAGE_ENCODING_GREEK ISO-8859-7 encoding
asMESSAGE_ENCODING_TURKISH ISO-8859-3 encoding
asMESSAGE_ENCODING_HEBREW ISO-8859-8 encoding
asMESSAGE_ENCODING_ARABIC ISO-8859-6 encoding
asMESSAGE_ENCODING_BALTIC ISO-8859-4 encoding
asMESSAGE_ENCODING_VIETNAMESE WINDOWS-1258 encoding
asMESSAGE_ENCODING_UTF7 UTF-7 encoding
asMESSAGE_ENCODING_UTF8 UTF-8 encoding

10.1.4. SMTP Authentication Values

Name Description
asAUTH_SMTP_AUTO Auto detect (default)
asAUTH_SMTP_PLAIN AUTH-PLAIN authentication
asAUTH_SMTP_LOGIN AUTH-LOGIN authentication
asAUTH_SMTP_MD5CRAM AUTH-CRAM-MD5 authentication

10.1.5. POP3 Authentication Values

Name Description
asAUTH_POP3_AUTO Auto detect (default)
asAUTH_POP3_PLAIN AUTH-PLAIN authentication
asAUTH_POP3_APOP APOP authentication

10.2. Error Codes

When a function is called, the result of the function is stored in the object's 'LastError' property.
When 'LastError' is 0, it means that the last called function completed successfully; otherwise, an error occured.

The value of the LastError tells you why the function failed. All error codes are listed on the ActiveXperts web site:

www.activexperts.com/support/errorcodes (list of error codes).

Here, you can also lookup a specific error to find its description.

You can also call the 'GetErrorDescription' function of any of the objects to find the error description.

11. Support

11.1. Product samples

Samples for Visual Basic, Visual Basic .NET, Visual C++, Visual C# .NET, ASP and VBScript are included as part of the installation. You can also find the samples on our ftp site at ftp://ftp.activexperts-labs.com/samples/aemail/.

11.2. ActiveXperts Support

Visit the ActiveXperts Support Site for a complete list of FAQ items at:
    http://www.activexperts.com/support

To contact support, please send an e-mail to: support@activexperts.com

12. Purchase and Product Activation

12.1. Purchase

Please visit www.activexperts.com/sales to buy the product. Here, you can also find the latest prices.

You can also contact us via email: sales@activexperts.com

12.2. Product Activation

After you purchase the product, you will receive a registration code. This code must be entered in the registry on your machine(s). There are three ways to accomplish this:

1. Automatic installation

The ActiveEmail Toolkit automatic installation performs all necessary steps to install and register the component. It will ask for the registration code during installation and will enter the registration code in the registry.

2. 'Activate' function

You can use the Activate function of any of the objects:, for instance

Set objSmtpServer = CreateObject("ActiveXperts.SmtpServer ")
objSmtpServer.Activate XXXXX-XXXXX-XXXXX", True ' Substitute XXXXX-XXXXX-XXXXX by your own registration code
                     ' Pass True to make the activation persistent, so you need to
                     ' call Activate  only once. If you pass False, you need to call Activate
                     ' each time the product is started.

The Activate function of any of the objects writes the following entry to the registry, which will actually activate the product:

    Key: HKEY_LOCAL_MACHINE\Software\ActiveXperts\ActiveEmail Toolkit\RegistrationKey  Type: REG_SZ  Value: XXXXX-XXXXX-XXXXX

where 'XXXXX-XXXXX-XXXXX' is the registration code issued to you.

3. Manually insert code in the registry

You can activate the product by editing the registry manually:

Distribution License

For information about how to use the registration code with a Distribution License, please read the following document: How to distribute an ActiveXperts Toolkit.

Appendix A - License Agreement

    
PLEASE READ THIS SOFTWARE LICENSE AGREEMENT CAREFULLY BEFORE 
DOWNLOADING OR USING THE SOFTWARE.  BY CLICKING ON THE 
"ACCEPT" BUTTON, OPENING THE PACKAGE, DOWNLOADING THE PRODUCT, 
OR USING THE EQUIPMENT THAT CONTAINS THIS PRODUCT, YOU ARE 
CONSENTING TO BE BOUND BY THIS AGREEMENT. IF YOU DO NOT AGREE 
TO ALL OF THE TERMS OF THIS AGREEMENT, CLICK THE "DO NOT 
ACCEPT" BUTTON AND THE INSTALLATION PROCESS WILL NOT CONTINUE, 
RETURN THE PRODUCT TO THE PLACE OF PURCHASE FOR A FULL REFUND, 
OR DO NOT DOWNLOAD THE PRODUCT.

GENERAL
In this Software License Agreement:
(i) "ActiveXperts" means ActiveXperts Software B.V.
(ii) "Customer" means the individual(s), organization or business entity 
buying a license of the Software from ActiveXperts or its Distributors 
or its Resellers.
(iii) "Software" means computer programs (and their storage medium) 
supplied by ActiveXperts and known collectively as "ActiveEmail" 
in which ActiveXperts has property rights and any user manuals, 
operating instructions, brochures and all other documentation relating 
to the said computer programs (the expression "Software" to include all 
or any part or any combination of Software).

1. LICENSE GRANT
ActiveXperts grants Customer the following rights provided that you 
comply with all terms and conditions of this License Agreement:

(a) Installation and use. Customer may install, use, access, display and 
run one copy of the Software on a single computer, such as a 
workstation, terminal or other device ("Workstation Computer"). A 
"License Pack" allows you to install, use, access, display and run 
additional copies of the Software up to the number of "Licensed Copies" 
specified above.

(b) Reservation of Rights. ActiveXperts reserves all rights not 
expressly granted to you in this License Agreement.

2. UPGRADES AND SUPPLEMENTS
To use a product identified as an upgrade, you must first be licensed 
for the Software as eligible for the upgrade. After upgrading, Customer 
may no longer use the product that formed the basis for Customer's 
upgrade eligibility.

This License Agreement applies to updates or supplements to the original 
Software provided by ActiveXperts, unless we provide other terms along 
with the update or supplement.

3. LIMITATION ON REVERSE ENGINEERING,DECOMPILATION, AND DISASSEMBLY
Customer may not reverse engineer, decompile, or disassemble the 
Software, except and only to the extent that it is expressly permitted 
by applicable law notwithstanding this limitation.

4. TERMINATION
Without prejudice to any other rights, ActiveXperts may cancel this 
License Agreement if Customer does not abide by the terms and conditions 
of this License Agreement, in which case you must destroy all copies of 
the Software and all of its component parts.

5. NOT FOR RESALE SOFTWARE
Software identified as "Not for Resale" or "NFR," may not be resold, 
transferred or used for any purpose other than demonstration, test or 
evaluation.

6. LIMITED WARRANTY
ActiveXperts warrants that for a period of ninety (90) days from the 
date of shipment from ActiveXperts: (i) the media on which the Software 
is furnished will be free of defects in materials and workmanship under 
normal use; and (ii) the Software substantially conforms to its 
published specifications. Except for the foregoing, the Software is 
provided AS IS. This limited warranty extends only to Customer as the 
original licensee. Customer's exclusive remedy and the entire liability 
of ActiveXperts and its suppliers under this limited warranty will be, 
at ActiveXperts or its service center's option, repair, replacement, or 
refund of the Software if reported (or, upon request, returned) to the 
party supplying the Software to Customer. In no event does ActiveXperts 
warrant that the Software is error free or that Customer will be able to 
operate the Software without problems or interruptions.
This warranty does not apply if the software (a) has been altered, 
except by ActiveXperts, (b) has not been installed, operated, repaired, 
or maintained in accordance with instructions supplied by ActiveXperts, 
(c) has been subjected to abnormal physical or electrical stress, 
misuse, negligence, or accident, or (d) is used in ultrahazardous 
activities.


7. LIMITATION OF LIABILITY AND REMEDIES.
Notwithstanding any damages that you might incur for any reason 
whatsoever (including, without limitation, all damages referenced above 
and all direct or general damages), the entire liability of ActiveXperts 
and any of its suppliers under any provision of this License Agreement 
and your exclusive remedy for all of the foregoing (except for any 
remedy of repair or replacement elected by ActiveXperts with respect to 
any breach of the Limited Warranty) shall be limited to the greater of 
the amount actually paid by you for the Software or U.S.$5.00. The 
foregoing limitations, exclusions and disclaimers (including Sections 4, 
5 and 6 above) shall apply to the maximum extent permitted by applicable 
law, even if any remedy fails its essential purpose.

8. ENTIRE AGREEMENT

This License Agreement (including any addendum or amendment to this 
License Agreements which is included with the Software) are the entire 
agreement between you and ActiveXperts relating to the Software and the 
support services (if any) and they supersede all prior or 
contemporaneous oral or written communications, proposals and 
representations with respect to the Software or any other subject matter 
covered by this License Agreement. To the extent the terms of any 
ActiveXperts policies or programs for support services conflict with the 
terms of this License Agreement, the terms of this License Agreement 
shall control.

This Agreement shall be construed in accordance with the laws of The 
Netherlands and the Dutch courts shall have sole jurisdiction in any 
dispute relating to these conditions. If any part of these conditions 
shall be or become invalid or unenforceable in any way and to any extent 
by any existing or future rule of law, order, statute or regulation 
applicable thereto, then the same shall to the extent of such invalidity 
or enforceability be deemed to have been deleted from the conditions 
which shall remain in full force and effect as regards all other 
provisions.

9. Copyright
The Software is protected by copyright and other intellectual property 
laws and treaties. ActiveXperts or its suppliers own the title, 
copyright, and other intellectual property rights in the Software. The 
Software is licensed, not sold.
© 2010 ActiveXperts Software B.V.  contact@activexperts.com