ActiveEmail provides an easy-to-use 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:
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.
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.
The ActiveEmail Toolkit can be used by any of the following programming languages:
The ActiveEmail Toolkit package consists of 4 components; any combination of components can be installed:
Simply run the AEMAIL.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.
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:
The following code snippets (VBScript) illustrate how to use various ActiveEmail objects.
Send an e-mail through the SMTP protocol.
Set objSmtp = CreateObject("ActiveEmail.Smtp") ' Create the SMTP Protocol object
Set objMail = CreateObject("ActiveEmail.EmailMessage") ' Create the e-mail message object
Wscript.Echo "ActiveEmail Version " & objSmtp.Version & "; Build " & _
objSmtp.Build & "; Module " & objSmtp.Module
WScript.Echo "Expiration date: " & objSmtp.ExpirationDate & vbCrLf
objSmtp.LogFile = "log.txt" ' Keep a session log
' Open a connection to the SMTP server
objSmtp.SetSecure
objSmtp.Connect "smtp.gmail.com", "me@gmail.com", "password"
If objSmtp.LastError <> 0 Then
WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)
WScript.Quit
End If
' Compose an e-mail message
objMail.FromAddress = "me@gmail.com"
objMail.FromName = "My Name"
objMail.Subject = "Hi !"
objMail.BodyPlainText = "Hello, How are you doing ?"
objMail.BodyHtml = "<html><body><h2>Hello</h2><p>How are you doing ?</p></body></html>"
objMail.AddTo "someone@example.com", "Someone"
' Send the e-mail
objSmtp.Send objMail
If objSmtp.LastError <> 0 Then
WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)
End If
' Disconnect from the server
objSmtp.Disconnect
WScript.Echo "Done !"
Receive e-mail messages through the POP3 protocol
Set objPop3 = CreateObject("ActiveEmail.Pop3") ' Create the POP3 protocol object
Set objMail = CreateObject("ActiveEmail.EmailMessage") ' Create the e-mail message object
Wscript.Echo "ActiveEmail Version " & objPop3.Version & "; Build " & _
objPop3.Build & "; Module " & objPop3.Module
WScript.Echo "Expiration date: " & objPop3.ExpirationDate & vbCrLf
objPop3.LogFile = "log.txt" ' Keep a session log
' Open a connection to the POP3 server
objPop3.SetSecure
objPop3.Connect "pop.gmail.com", "me@gmail.com", "password"
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
WScript.Quit
End If
' Retrieve all new messages
For i = 1 to objPop3.CountMessages()
Set objMail = objPop3.GetEmailMessage(i)
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
objPop3.Disconnect
WScript.Quit
End If
WScript.Echo "--------------------------------------------------------------"
WScript.Echo objMail.Date
WScript.Echo objMail.FromAddress
WScript.Echo objMail.Subject
WScript.Echo objMail.BodyPlainText
For j = 1 to objMail.CountAttachments()
strName = objMail.GetAttachmentName(j)
WScript.Echo " Attachment found: " & strName
' Uncomment the following lines to save the attachments.
'strPath = "C:\Temp\" & strName
'WScript.Echo " Saving attachment to : " & strPath
'objMail.SaveAttachment j, strPath
Next
Next
objPop3.Disconnect
WScript.Echo "Disconnected"
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 objEmail As EMailMessage ' Declaration objEmail = New EMailMessage() ' Creation Dim objSmtp As Smtp ' Declaration objSmtp = New Smtp() ' Creation Dim objPop3 As Pop3 ' Declaration objPop3 = New Pop3() ' Creation
After these declarations and creation of the object(s), you can use the objects inside your Visual Basic .NET project.
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 objEmail EMailMessage; // Declaration objEmail = new EMailMessage(); // Creation objSmtp Smtp; // Declaration objSmtp = new Smtp(); // Creation objPop3 Pop3; // Declaration objPop3 = new Pop3(); // Creation
After these declarations and creation of the object(s), you can use the objects inside your Visual C# .NET project.
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("ActiveEmail.EMailConstants") ' Creation Dim objEmail As AEMAILLib.EMailMessage ' Declaration Set objEmail = CreateObject( "ActiveEmail.EMailMessage") ' Creation Dim objSmtp As AEMAILLib.Smtp ' Declaration Set objSmtp = CreateObject( "ActiveEmail.Smtp" ) ' Creation Dim objPop3 As AEMAILLib.Pop3 ' Declaration Set objPop3 = CreateObject( "ActiveEmail.Pop3" ) ' Creation
After these declarations and creation of the object(s), you can use the objects inside your Visual Basic 5.x/6.x project.
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 ); IEMailMessage *pEMail; CoCreateInstance(CLSID_EMailMessage, NULL, CLSCTX_INPROC_SERVER, IID_IEMailMessage, (void**) &pEMail ); ISmtpS *pSmtp; CoCreateInstance(CLSID_Smtp, NULL, CLSCTX_INPROC_SERVER, IID_ISmtp, (void**) &pSmtp ); IPop3 *pPop3; CoCreateInstance(CLSID_Pop3, NULL, CLSCTX_INPROC_SERVER, IID_IPop3, (void**) &pPop3 );
Visual C++ samples are installed as part of the product, but can also be found on our website.
<html> <body> Version: <script language=vbscript runat=server> Set objSmtpServer = CreateObject( "ActiveEmail.Smtp" ) Response.Write objSmtp.Version </script> </body> </html>
The Smtp object can be used to connect to a remote SMTP server and send out one or more e-mail messages.
Send an e-mail through the SMTP protocol
Set objSmtp = CreateObject("ActiveEmail.Smtp") ' Create the SMTP Protocol object
Set objMail = CreateObject("ActiveEmail.EmailMessage") ' Create the e-mail message object
Wscript.Echo "ActiveEmail Version " & objSmtp.Version & "; Build " & _
objSmtp.Build & "; Module " & objSmtp.Module
WScript.Echo "Expiration date: " & objSmtp.ExpirationDate & vbCrLf
objSmtp.LogFile = "log.txt" ' Keep a session log
' Open a connection to the SMTP server
objSmtp.SetSecure
objSmtp.Connect "smtp.gmail.com", "me@gmail.com", "password"
If objSmtp.LastError <> 0 Then
WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)
WScript.Quit
End If
' Compose an e-mail message
objMail.FromAddress = "me@gmail.com"
objMail.FromName = "My Name"
objMail.Subject = "Hi !"
objMail.BodyPlainText = "Hello, How are you doing ?"
objMail.BodyHtml = "<html><body><h2>Hello</h2><p>How are you doing ?</p></body></html>"
objMail.AddTo "someone@example.com", "Someone"
' Send the e-mail
objSmtp.Send objMail
If objSmtp.LastError <> 0 Then
WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)
End If
' Disconnect from the server
objSmtp.Disconnect
WScript.Echo "Done !"
| Property | Type | Read/Write | Description |
| Version | String | Read | Version number of the ActiveEmail |
| Build | String | Read | Build number of the ActiveEmail |
| Module | String | Read | Module name of the ActiveEmail |
| ExpirationDate | String | Read | Expiration date of the ActiveEmail |
| LastError | Number | Read | Result of the last called method |
| LogFile | String | Read/Write | The path to a logfile which can be used for troubleshooting |
| HostPort | Number | Read/Write | The host port of the SMTP server to connect to |
| Authentication | Number | Read/Write | The SMTP authentication method |
| UseStartTls | Boolean | Read/Write | Use a secure connection if possible |
| LastSmtpResponse | String | Read | Last SMTP response from the server |
| TimeoutConnect | Number | Read/Write | Timeout (msecs) for a connection to be established |
| TimeoutAuthentication | Number | Read/Write | Timeout (msecs) to authenticate |
| TimeoutCommand | Number | Read/Write | Timeout (msecs) for each SMTP command to complete |
| TimeoutData | Number | Read/Write | Timeout (msecs) for the SMTP DATA command to complete |
| Function | Description |
| Activate | Activate the product |
| Clear | Reset all properties to their default values |
| GetErrorDescription | Get the description of the given error |
| Sleep | Sleep for the specified number of milliseconds |
| SetSecure | Enables TLS/SSL and sets the correct port number |
| Connect | Connect to the SMTP server |
| Disconnect | Disconnect from the SMTP server |
| Send | Send an e-mail message |
| Queue | Queue an e-mail message |
Return the version number of the ActiveEmail
Example:
Set objSmtp = CreateObject("ActiveEmail.Smtp")
Wscript.Echo "ActiveEmail Version " & objSmtp.Version & "; Build " & _
objSmtp.Build & "; Module " & objSmtp.Module
WScript.Echo "Expiration date: " & objSmtp.ExpirationDate & vbCrLf
...
Return the build number of the ActiveEmail.
Example:
Set objSmtp = CreateObject("ActiveEmail.Smtp")
Wscript.Echo "ActiveEmail Version " & objSmtp.Version & "; Build " & _
objSmtp.Build & "; Module " & objSmtp.Module
WScript.Echo "Expiration date: " & objSmtp.ExpirationDate & vbCrLf
...
Return the module name of the ActiveEmail.
Example:
Set objSmtp = CreateObject("ActiveEmail.Smtp")
Wscript.Echo "ActiveEmail Version " & objSmtp.Version & "; Build " & _
objSmtp.Build & "; Module " & objSmtp.Module
WScript.Echo "Expiration date: " & objSmtp.ExpirationDate & vbCrLf
...
Return the expiration date of the ActiveEmail.
Example:
Set objSmtp = CreateObject( "ActiveEmail.Smtp" )
Wscript.Echo "ActiveEmail Version " & objSmtp.Version & "; Build " & _
objSmtp.Build & "; Module " & objSmtp.Module
WScript.Echo "Expiration date: " & objSmtp.ExpirationDate & vbCrLf
...
Completion code of the last called function. To find the error description of a given error code, go to the online error codes codes page.
Example:
Set objSmtp = CreateObject("ActiveEmail.Smtp")
...
Set objMessage = CreateObject("ActiveEmail.SmsMessage")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
objSmtp.SendSms objMessage
WScript.Echo "Send SMS result: " & objSmtp.LastError ' Is our message sent ?
...
By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the ActiveEmail will write debug information to this file. Output data is written at the end of the file, the file is not cleared.
Example:
Set objSmtp = CreateObject("ActiveEmail.Smtp")
objSmtp.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("ActiveEmail.SmsMessage")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
objSmtp.SendSms objMessage
...
This is the host port of the SMTP server to connect to. Set this property if the port is different from the standard SMTP port (25).
Example:
Set objSmtp = CreateObject("ActiveEmail.Smtp")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
...
objSmtp.HostPort = 8025
objSmtp.Connect "smtp.example.com", "me@example.com", "password"
If objSmtp.LastError <> 0 Then
WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)
WScript.Quit
End If
...
This is the authentication method that should be used. By default the preferred authentication method will be automatically detected.
Use one of these constants.
Example:
Set objSmtp = CreateObject("ActiveEmail.Smtp")
Set objConst = CreateObject("ActiveEmail.EmailConstants")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
...
objSmtp.Authentication = objConst.SMTP_AUTH_MD5CRAM
objSmtp.Connect "smtp.example.com", "me@example.com", "password"
If objSmtp.LastError <> 0 Then
WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)
WScript.Quit
End If
...
Use a secure connection if supported by the SMTP server.
If the proprty is set to True, Connect will start a secure connection if the SMTP server supports it.
If the proprty is set to False, Connect will NOT start a secure connection, even in case the SMTP does support it.
Example:
Set objSmtp = CreateObject("ActiveEmail.Smtp")
Set objConst = CreateObject("ActiveEmail.EmailConstants")
...
Set objSmtp.UseStartTls = False
objSmtp.Connect "smtp.example.com", "me@example.com", "password"
If objSmtp.LastError <> 0 Then
WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)
WScript.Quit
End If
...
The last SMTP response from the server
Example:
Set objSmtp = CreateObject("ActiveEmail.Smtp")
Set objConst = CreateObject("ActiveEmail.EmailConstants")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
...
objSmtp.Connect "smtp.example.com", "me@example.com", "password"
WScript.Echo "Server response: " & objSmtp.LastSmtpResponse
If objSmtp.LastError <> 0 Then
WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)
WScript.Quit
End If
...
Timeout (in milliseconds) for a connection to be established.
Example:
Set objSmtp = CreateObject("ActiveEmail.Smtp")
...
objSmtp.TimeoutConnect = 10000
objSmtp.Connect "smtp.example.com", "", ""
WScript.Echo "Server response: " & objSmtp.LastSmtpResponse
If objSmtp.LastError <> 0 Then
WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)
WScript.Quit
End If
...
Timeout (in milliseconds) to authenticate to the SMTP mail server.
Example:
Set objSmtp = CreateObject("ActiveEmail.Smtp")
...
objSmtp.TimeoutAuthentication = 10000
objSmtp.Connect "smtp.example.com", "me@example.com", "password"
WScript.Echo "Server response: " & objSmtp.LastSmtpResponse
If objSmtp.LastError <> 0 Then
WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)
WScript.Quit
End If
...
Timeout (in milliseconds) for each SMTP command to complete. This applies to all SMTP commands (e.g.: AUTH, RCPT TO, QUIT) except the DATA command.
Example:
Set objSmtp = CreateObject("ActiveEmail.Smtp")
...
objSmtp.Connect "smtp.example.com", "me@example.com", "password"
...
objSmtp.TimeoutCommand = 5000
objSmtp.Send( objMail )
...
Timeout (msecs) for the SMTP DATA command to complete.
Example:
Set objSmtp = CreateObject("ActiveEmail.Smtp")
...
objSmtp.Connect "smtp.example.com", "me@example.com", "password"
...
objSmtp.TimeoutData = 120000
objSmtp.Send( objMail )
...
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 objSmtp = CreateObject("ActiveEmail.Smtp")
objSmtp.Activate "xxxxx-xxxxx-xxxxx", True
...
This function resets all properties to their default values.
Parameters:
Return value:
Always 0.
Example: Set objSmtp = CreateObject("ActiveEmail.Smtp")
....
objSmtp.Clear
...
GetErrorDescription provides the error description of a given error code.
Parameters:
Return value:
The error string.
Example: Set objSmtp = CreateObject("ActiveEmail.Smtp")
...
WScript.Echo "result: " & objSmtp.LastError & ", " & _
objSmtp.GetErrorDescription(objSmtp.LastError)
This function suspends the current thread for the specified number of milliseconds.
Parameters:
Return value:
Always 0.
Example: Set objSmtp = CreateObject("ActiveEmail.Smtp")
....
objSmtp.Sleep 1000
...
This function makes sure TLS/SSL is enabled and the port number to connect on is set correctly.
Parameters:
Return value:
Always 0.
Example: Set objSmtp = CreateObject("ActiveEmail.Smtp")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
...
objSmtp.SetSecure
objSmtp.Connect "smtp.gmail.com", "me@gmail.com", "password"
If objSmtp.LastError <> 0 Then
WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)
WScript.Quit
End If
...
This function connects to the specified SMTP server
Parameters:
Return value:
Always 0.
Example: Set objSmtp = CreateObject("ActiveEmail.Smtp")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
...
objSmtp.Connect "smtp.gmail.com", "me@gmail.com", "password"
If objSmtp.LastError <> 0 Then
WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)
WScript.Quit
End If
...
This function disconnects from the SMTP server
Parameters:
Return value:
Always 0.
Example: Set objSmtp = CreateObject("ActiveEmail.Smtp")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
...
objSmtp.Connect "smtp.gmail.com", "me@gmail.com", "password"
If objSmtp.LastError <> 0 Then
WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)
WScript.Quit
End If
...
objSmtp.Disconnect
This functions sends the specified e-mail.
Parameters:
Return value:
Always 0.
Example: Set objSmtp = CreateObject("ActiveEmail.Smtp")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
...
objMail.BodyPlainText = "Hello, How are you doing ?"
objMail.BodyHtml = "<html><body><h2>Hello</h2><p>How are you doing ?</p></body></html>"
objMail.AddTo "someone@example.com", "Someone"
...
objSmtp.Send objMail
If objSmtp.LastError <> 0 Then
WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)
End If
...
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.
Example: Set objSmtp = CreateObject("ActiveEmail.Smtp")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
...
objMail.BodyPlainText = "Hello, How are you doing ?"
objMail.BodyHtml = "<html><body><h2>Hello</h2><p>How are you doing ?</p></body></html>"
objMail.AddTo "someone@example.com", "Someone"
...
objSmtp.Queue objMail, "mail.mycompany.intra", 25, False, "", ""
If objSmtp.LastError <> 0 Then
WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)
End If
...
The Pop3 object can be used to connect to a POP3 server and receive e-mail messages.
Receive e-mail messages through the POP3 protocol
Set objPop3 = CreateObject("ActiveEmail.Pop3") ' Create the POP3 protocol object
Set objMail = CreateObject("ActiveEmail.EmailMessage") ' Create the e-mail message object
Wscript.Echo "ActiveEmail Version " & objPop3.Version & "; Build " & _
objPop3.Build & "; Module " & objPop3.Module
WScript.Echo "Expiration date: " & objPop3.ExpirationDate & vbCrLf
objPop3.LogFile = "log.txt" ' Keep a session log
' Open a connection to the POP3 server
objPop3.SetSecure
objPop3.Connect "pop.gmail.com", "me@gmail.com", "password"
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
WScript.Quit
End If
' Retrieve all new messages
For i = 1 to objPop3.CountMessages()
Set objMail = objPop3.GetEmailMessage(i)
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
objPop3.Disconnect
WScript.Quit
End If
WScript.Echo "--------------------------------------------------------------"
WScript.Echo objMail.Date
WScript.Echo objMail.FromAddress
WScript.Echo objMail.Subject
WScript.Echo objMail.BodyPlainText
For j = 1 to objMail.CountAttachments()
strName = objMail.GetAttachmentName(j)
WScript.Echo " Attachment found: " & strName
' Uncomment the following lines to save the attachments.
'strPath = "C:\Temp\" & strName
'WScript.Echo " Saving attachment to : " & strPath
'objMail.SaveAttachment j, strPath
Next
Next
objPop3.Disconnect
WScript.Echo "Disconnected"
| Property | Type | Read/Write | Description |
| Version | String | Read | Version number of the ActiveEmail |
| Build | String | Read | Build number of the ActiveEmail |
| Module | String | Read | Module name of the ActiveEmail |
| ExpirationDate | String | Read | Expiration date of the ActiveEmail |
| LastError | Number | Read | Result of the last called method |
| LogFile | String | Read/Write | The path to a logfile which can be used for troubleshooting |
| HostPort | Number | Read/Write | The host port for the POP3 server |
| Authentication | Number | Read/Write | The authentication method |
| Timeout | Number | Read/Write | Connection timeout |
| LastPop3Response | String | Read/Write | The host port for the POP3 server |
| TimeoutConnect | Number | Read/Write | Timeout (msecs) for a connection to be established |
| TimeoutAuthentication | Number | Read/Write | Timeout (msecs) to authenticate |
| TimeoutCommand | Number | Read/Write | Timeout (msecs) for each POP3 command to complete |
| TimeoutData | Number | Read/Write | Timeout (msecs) for the POP3 RETR command to complete |
| Function | Description |
| Clear | Reset all properties to their default values |
| GetErrorDescription | Get the description of the given error |
| Sleep | Sleep for the specified number of milliseconds |
| SetSecure | Enable TLS/SSL and set the correct port number |
| Connect | Connect to the specified POP3 server |
| Disconnect | Disconnect from the POP3 server |
| IsConnected | Returns the connected state |
| CountMessages | Count the number of messages in the mail-drop |
| DeleteMessage | Delete a message from the mail-drop |
| GetEmailHeader | Retrieve the e-mail header |
| GetEmailMessage | Retrieve the e-mail message |
Return the version number of the ActiveEmail
Example:
Set objPop3 = CreateObject("ActiveEmail.Pop3")
Wscript.Echo "ActiveEmail Version " & objPop3.Version & "; Build " & _
objPop3.Build & "; Module " & objPop3.Module
WScript.Echo "Expiration date: " & objPop3.ExpirationDate & vbCrLf
...
Return the build number of the ActiveEmail.
Example:
Set objPop3 = CreateObject("ActiveEmail.Pop3")
Wscript.Echo "ActiveEmail Version " & objPop3.Version & "; Build " & _
objPop3.Build & "; Module " & objPop3.Module
WScript.Echo "Expiration date: " & objPop3.ExpirationDate & vbCrLf
...
Return the module name of the ActiveEmail.
Example:
Set objPop3 = CreateObject("ActiveEmail.Pop3")
Wscript.Echo "ActiveEmail Version " & objPop3.Version & "; Build " & _
objPop3.Build & "; Module " & objPop3.Module
WScript.Echo "Expiration date: " & objPop3.ExpirationDate & vbCrLf
...
Return the expiration date of the ActiveEmail.
Example:
Set objPop3 = CreateObject( "ActiveEmail.Pop3" )
Wscript.Echo "ActiveEmail Version " & objPop3.Version & "; Build " & _
objPop3.Build & "; Module " & objPop3.Module
WScript.Echo "Expiration date: " & objPop3.ExpirationDate & vbCrLf
...
Completion code of the last called function. To find the error description of a given error code, go to the online error codes codes page.
Example:
Set objPop3 = CreateObject("ActiveEmail.Pop3")
...
Set objMessage = CreateObject("ActiveEmail.SmsMessage")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
objPop3.SendSms objMessage
WScript.Echo "Send SMS result: " & objPop3.LastError ' Is our message sent ?
...
By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the ActiveEmail will write debug information to this file. Output data is written at the end of the file, the file is not cleared.
Example:
Set objPop3 = CreateObject("ActiveEmail.Pop3")
objPop3.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("ActiveEmail.SmsMessage")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
objPop3.SendSms objMessage
...
Set the host port to connect to. By default this is 110.
Example:
Set objPop3 = CreateObject("ActiveEmail.Pop3")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
objPop3.HostPort = 8110
objPop3.Connect "pop.example.com", "me@example.com", "password"
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
WScript.Quit
End If
...
Set the authentication method to use on the POP3 server. By default it will autodetect the preferred method.
Example:
Set objPop3 = CreateObject("ActiveEmail.Pop3")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
objPop3.Authentication = POP3_AUTH_PLAIN
objPop3.Connect "pop.example.com", "me@example.com", "password"
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
WScript.Quit
End If
...
Set the connection timeout in milliseconds
Example:
Set objPop3 = CreateObject("ActiveEmail.Pop3")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
objPop3.Timeout = 10000
objPop3.Connect "pop.example.com", "me@example.com", "password"
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
WScript.Quit
End If
...
Example:
Set objPop3 = CreateObject("ActiveEmail.Pop3")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
objPop3.Connect "pop.example.com", "me@example.com", "password"
WScript.Echo "Server reponse: " & objPop3.LastPop3Response
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
WScript.Quit
End If
...
Timeout (in milliseconds) for a connection to be established.
Example:
Set objPop3 = CreateObject("ActiveEmail.Pop3")
objPop3.TimeoutConnect = 10000
objPop3.Connect "pop.example.com", "me@example.com", "password"
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
WScript.Quit
End If
...
Timeout (in milliseconds) to authenticate to the POP3 mail server.
Example:
Set objPop3 = CreateObject("ActiveEmail.Pop3")
objPop3.TimeoutAuthentication = 10000
objPop3.Connect "pop.example.com", "me@example.com", "password"
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
WScript.Quit
End If
...
Timeout (in milliseconds) for each POP3 command to complete. This applies to all POP3 commands (e.g.: APOP, CAPA, QUIT) except the RETR command.
Example:
Set objPop3 = CreateObject("ActiveEmail.Pop3")
objPop3.TimeoutCommand = 10000
For i = 1 to objPop3.CountMessages()
Set objMail = objPop3.GetEmailMessage(i)
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
objPop3.Disconnect
WScript.Quit
End If
WScript.Echo "--------------------------------------------------------------"
WScript.Echo objMail.Date
WScript.Echo objMail.FromAddress
WScript.Echo objMail.Subject
WScript.Echo objMail.BodyPlainText
Next
...
Timeout (msecs) for the POP3 RETR command to complete.
Example:
Set objPop3 = CreateObject("ActiveEmail.Pop3")
objPop3.TimeoutData = 120000
For i = 1 to objPop3.CountMessages()
Set objMail = objPop3.GetEmailMessage(i)
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
objPop3.Disconnect
WScript.Quit
End If
WScript.Echo "--------------------------------------------------------------"
WScript.Echo objMail.Date
WScript.Echo objMail.FromAddress
WScript.Echo objMail.Subject
WScript.Echo objMail.BodyPlainText
Next
...
This function resets all properties to their default values.
Parameters:
Return value:
Always 0.
Example: Set objPop3 = CreateObject("ActiveEmail.Pop3")
....
objPop3.Clear
...
GetErrorDescription provides the error description of a given error code.
Parameters:
Return value:
The error string.
Example: Set objPop3 = CreateObject("ActiveEmail.Pop3")
...
WScript.Echo "result: " & objPop3.LastError & ", " & _
objPop3.GetErrorDescription(objPop3.LastError)
This function suspends the current thread for the specified number of milliseconds.
Parameters:
Return value:
Always 0.
Example: Set objPop3 = CreateObject("ActiveEmail.Pop3")
...
objPop3.Sleep 1000
...
This function enables TLS/SSL and sets the correct port number.
Parameters:
Return value:
Always 0.
Example: Set objPop3 = CreateObject("ActiveEmail.Pop3")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
...
objPop3.SetSecure
objPop3.Connect "pop.gmail.com", "me@gmail.com", "password"
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
WScript.Quit
End If
...
This function connects to the POP3 server.
Parameters:
Return value:
Always 0.
Example: Set objPop3 = CreateObject("ActiveEmail.Pop3")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
...
objPop3.Connect "pop.gmail.com", "me@gmail.com", "password"
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
WScript.Quit
End If
...
This function disconnects from the POP3 server.
Parameters:
Return value:
Always 0.
Example: Set objPop3 = CreateObject("ActiveEmail.Pop3")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
...
objPop3.Connect "pop.gmail.com", "me@gmail.com", "password"
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
WScript.Quit
End If
...
objPop3.Disconnect
This function returns the connected state. True is connected, False if not connected.
Parameters:
Return value:
Always 0.
Example: Set objPop3 = CreateObject("ActiveEmail.Pop3")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
...
objPop3.Connect "pop.gmail.com", "me@gmail.com", "password"
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
WScript.Quit
End If
...
WScript.Echo objPop3.IsConnected
...
objPop3.Disconnect
This function requests the number of messages in the mail drop.
Parameters:
Return value:
The number of messages in the mail-drop
Example: Set objPop3 = CreateObject("ActiveEmail.Pop3")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
...
For i = 1 to objPop3.CountMessages()
Set objMail = objPop3.GetEmailMessage(i)
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
objPop3.Disconnect
WScript.Quit
End If
WScript.Echo "--------------------------------------------------------------"
WScript.Echo objMail.Date
WScript.Echo objMail.FromAddress
WScript.Echo objMail.Subject
WScript.Echo objMail.BodyPlainText
Next
...
This function deletes a message from the mail-drop. This prevents the mail server from including this e-mail on the next connect.
Parameters:
Return value:
Always 0.
Example: Set objPop3 = CreateObject("ActiveEmail.Pop3")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
...
For i = 1 to objPop3.CountMessages()
Set objMail = objPop3.GetEmailMessage(i)
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
objPop3.Disconnect
WScript.Quit
End If
WScript.Echo "--------------------------------------------------------------"
WScript.Echo objMail.Date
WScript.Echo objMail.FromAddress
WScript.Echo objMail.Subject
WScript.Echo objMail.BodyPlainText
objPop3.DeleteMessage objMessage.ID
Next
...
This function only returns the e-mail header. On most mail servers this will be faster than retrieving the entire message body.
Parameters:
Return value:
Always 0.
Example: Set objPop3 = CreateObject("ActiveEmail.Pop3")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
...
For i = 1 to objPop3.CountMessages()
Set objMail = objPop3.GetEmailHeader(i)
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
objPop3.Disconnect
WScript.Quit
End If
WScript.Echo "--------------------------------------------------------------"
WScript.Echo objMail.Date
WScript.Echo objMail.FromAddress
WScript.Echo objMail.Subject
Next
...
This function retrieves the e-mail message
Parameters:
Return value:
Always 0.
Example: Set objPop3 = CreateObject("ActiveEmail.Pop3")
Set objMail = CreateObject("ActiveEmail.EmailMessage")
...
For i = 1 to objPop3.CountMessages()
Set objMail = objPop3.GetEmailMessage(i)
If objPop3.LastError <> 0 Then
WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)
objPop3.Disconnect
WScript.Quit
End If
WScript.Echo "--------------------------------------------------------------"
WScript.Echo objMail.Date
WScript.Echo objMail.FromAddress
WScript.Echo objMail.Subject
WScript.Echo objMail.BodyPlainText
Next
...
The EMailMessage object represents an e-mail message. The POP3 protocol receives e-mail messages and the SMTP protocol can be used to send e-mail messages.
| Property | Type | Read/Write | Description |
| LastError | Number | Read | Result of the previously called function |
| Subject | String | Read/Write | The Subject of the message |
| BodyPlainText | String | Read/Write | The plain-text body of the message |
| BodyHtml | String | Read/Write | The html body of the message |
| Priority | Number | Read/Write | The Priority of the message. |
| FromName | String | Read/Write | The sender's name |
| FromAddress | String | Read/Write | The sender's e-mail address |
| ReplyAddress | String | Read/Write | The Sender's reply-address. |
| ReadReceiptAddress | String | Read/Write | E-mail address to send a read receipt to |
| Organization | String | Read/Write | The sender's organization name |
| MessageSource | String | Read | The source of the e-mail message |
| MessageHeader | String | Read | The header of the e-mail message |
| Size | Number | Read | The sender's organization name |
| Date | String | Read | The e-mail date |
| ToAddress | String | Read | The 'To' address(es) |
| CcAddress | String | Read | The 'Cc' address(es) |
| BccAddress | String | Read | The 'Bcc' address(es) |
| Encoding | Number | Read/Write | SMTP specific. Encoding used to send create this message |
| ID | Number | Read | POP3 specific, The e-mail index on the server |
| Function | Description |
| Clear | Reset all properties to their default values |
| AddHeader | Add an additional header value to the e-mail |
| GetHeaderValue | Get a header value from the e-mail |
| AddTo | Add an e-mail recipient |
| AddCc | Add a 'Carbon Copy' recipient |
| AddBcc | Add a 'Blind Carbon Copy' recipient |
| AddAttachment | Add an attachment to the e-mail |
| CountAttachments | Number of attachments attached to the e-mail |
| GetAttachmentName | Get the name of an attachment |
| GetAttachmentSize | Get the size of an attachment |
| SaveAttachment | Save the attachment to a file |
| Encode | Encode an e-mail to mime |
| Decode | Decode the given e-mail |
| LoadMIME | Load a MIME file |
| SaveMIME | Save a MIME file |
This read-only property indicates the result of the last called function. 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("ActiveEmail.EMailMessage")
...
objEMailMessage.AddAttachment( "C:\File.txt" )
WScript.Echo "Result code: " & objEMailMessage.LastError
...
This is the subject of the e-mail message.
Example:
Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
objEMailMessage.Subject = "This is an important message"
...
This is the plain text body of the message. When sending e-mail, set this property to the plain text part of the e-mail message. When receiving e-mail, this property will be set to the plain text part if a plain text part is available.
Example:
Set objEMail = CreateObject("ActiveEmail.EMailMessage")
Set objConstants = CreateObject("ActiveEmail.EMailConstants")
...
objEMail.AddAttachment "C:\MySelf.jpg"
objEMail.AddAttachment "C:\MyWife.jpg"
objEMail.BodyPlainText = "Find a picture of myself and my wife attached to this e-mail."
objEMail.BodyHtml = "<html><body>This <img SRC="cid:1"> is me" &_
"<br>and <img SRC="cid:2"> my wife<br></body></html>"
...
This is the HTML body of the message. When sending e-mail, set this property to the HTML part of the e-mail message. When receiving e-mail, this property will be set to the HTML part if a HTML part is available.
Example:
Set objEMail = CreateObject("ActiveEmail.EMailMessage")
Set objConstants = CreateObject("ActiveEmail.EMailConstants")
...
objEMail.AddAttachment "C:\MySelf.jpg"
objEMail.AddAttachment "C:\MyWife.jpg"
objEMail.BodyPlainText = "Find a picture of myself and my wife attached to this e-mail."
objEMail.BodyHtml = "<html><body>This <img SRC="cid:0000001"> is me" &_
"<br>and <img SRC="cid:0000002"> my wife<br></body></html>"
...
The e-mail priority. This can be used by the e-mail client, such as outlook, to control how to display this e-mail.
Example:
Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
Set objConstants = CreateObject("ActiveEmail.EMailConstants")
...
objEMailMessage.Priority = objConstants.EMAIL_MESSAGE_PRIORITY_HIGH
...
The name of the e-mail sender. This file can be left empty.
Example:
Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
objEMailMessage.FromAddress = "me@mydomain.doc"
objEMailMessage.FromName = "This is Me"
...
Example:
Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
objEMailMessage.FromAddress = "me@mydomain.doc"
objEMailMessage.FromName = "This is Me"
...
The sender's reply address. If this is left empty the from address will be used as the reply address.
Example:
Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
objEMailMessage.ReplyAddress = "myself@mydomain.com"
...
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 objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
objEMailMessage.ReadReceiptAddress = "myself@mydomain.com"
...
This is the sender name of the organization of the sender.
Example:
Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
objEMailMessage.Organization = "My Organization"
...
This is the source of the e-mail message.
Example:
Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
WScript.Echo objEMailMessage.MessageSource
...
This is the header of the e-mail message.
Example:
Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
WScript.Echo objEMailMessage.MessageHeader
...
This is the sender name of the organization of the sender.
Example:
Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
WScript.Echo objEMailMessage.Size
...
This returns the e-mail date field.
Example:
Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
WScript.Echo objEMailMessage.Date
...
Returns a 'comma seperated' string of 'To' addresses for this e-mail.
Example:
Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
WScript.Echo objEMailMessage.ToAddress
WScript.Echo objEMailMessage.CcAddress
WScript.Echo objEMailMessage.BccAddress
...
Returns a 'comma seperated' string of 'Cc' addresses for this e-mail.
Example:
Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
WScript.Echo objEMailMessage.ToAddress
WScript.Echo objEMailMessage.CcAddress
WScript.Echo objEMailMessage.BccAddress
...
Returns a 'comma seperated' string of 'Bcc' addresses for this e-mail.
Example:
Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
WScript.Echo objEMailMessage.ToAddress
WScript.Echo objEMailMessage.CcAddress
WScript.Echo objEMailMessage.BccAddress
...
When creating a message using a specific extended ASCII encoding, like ISO-8859-6 (Arabic), use this property to set the encoding to the proper value.
Use one of these values.
Example:
Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
Set objConstants = CreateObject("ActiveEmail.EMailConstants")
...
objEMailMessage.Encoding = objConstants.EMAIL_MESSAGE_ENCODING_ARABIC
...
This is the index in the mail-drop on the POP3 server.
Example:
Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
WScript.Echo objEMailMessage.ID
...
This function resets all properties to their default values.
Parameters:
Return value:
Always 0.
Example: Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
objEMailMessage.Clear
...
This function will add a header value to the e-mail.
Parameters:
Return value:
Always 0.
Example: Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
objEMailMessage.AddHeader "X-Bender", "Bite my shiny metal ass."
...
This function returns the given header value if it can be found.
Parameters:
Return value:
The header value.
Example: Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
WScript.Echo objEMailMessage.GetHeader("X-UIDL")
...
This functions adds an e-mail recipient to the e-mail.
Parameters:
Return value:
Always 0.
Example: Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
objEMailMessage.AddTo "someone@example.com", "Someone"
objEMailMessage.AddCc "myboss@example.com", "My Boss"
objEMailMessage.AddBcc "coworker@example.com", "Co Worker"
...
This function adds a recipient to the 'Carbon Copy' (CC) list.
Parameters:
Return value:
Always 0.
Example: Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
objEMailMessage.AddTo "someone@example.com", "Someone"
objEMailMessage.AddCc "myboss@example.com", "My Boss"
objEMailMessage.AddBcc "coworker@example.com", "Co Worker"
...
This function adds a recipient to the 'Blind Carbon Copy' (BCC) list
Parameters:
Return value:
Always 0.
Example: Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
objEMailMessage.AddTo "someone@example.com", "Someone"
objEMailMessage.AddCc "myboss@example.com", "My Boss"
objEMailMessage.AddBcc "coworker@example.com", "Co Worker"
...
This function adds an attachment to the e-mail.
Parameters:
Return value:
Always 0.
Example: Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
objEMailMessage.AddAttachment "C:\Temp\file.zip"
If objEMailMessage.LastError <> 0 Then
WScript.Echo "Error: " & objEMailMessage.GetErrorDescription(objEmailMessage.LastError)
End If
...
This function counts the number of attachments on this e-mail
Parameters:
Return value:
The number of attachments
Example: Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
For j = 1 to objMail.CountAttachments()
strName = objMail.GetAttachmentName(j)
WScript.Echo " Attachment found: " & strName
strPath = "C:\Temp\" & strName
WScript.Echo " Saving attachment to : " & strPath
objMail.SaveAttachment j, strPath
Next
...
This function returns the filename of the attachment identified by the given ID. If the filename is not available it will return the name of the attachment.
The ID of the attachment ranges from 1 to CountAttachments
Parameters:
Return value:
The name of the attachment
Example: Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
For j = 1 to objMail.CountAttachments()
strName = objMail.GetAttachmentName(j)
WScript.Echo " Attachment found: " & strName
strPath = "C:\Temp\" & strName
WScript.Echo " Saving attachment to : " & strPath
objMail.SaveAttachment j, strPath
Next
...
This function returns the size of the attachment identified by the given ID. This is the size of the attachment before it is decoded.
The ID of the attachment ranges from 1 to CountAttachments
Parameters:
Return value:
The size of the attachment
Example: Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
For j = 1 to objMail.CountAttachments
strName = objMail.GetAttachmentName(j)
WScript.Echo " Attachment found: " & strName & "; Size: " & objMail.GetAttachmentSize(j)
strPath = "C:\Temp\" & strName
WScript.Echo " Saving attachment to : " & strPath
objMail.SaveAttachment j, strPath
Next
...
This function saves the attachment identified by the given Id.
The ID of the attachment ranges from 1 to CountAttachments
Parameters:
Return value:
Always 0.
Example: Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
For j = 1 to objMail.CountAttachments
strName = objMail.GetAttachmentName(j)
WScript.Echo " Attachment found: " & strName
strPath = "C:\Temp\" & strName
WScript.Echo " Saving attachment to : " & strPath
objMail.SaveAttachment j, strPath
Next
...
This function actually encodes the e-mail to the MIME format.
If you are creating a MIME encoded message to send it out at a later time always call this function before calling SaveMIME.
Parameters:
Return value:
Always 0.
Example: Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
objEMailMessage.Encode
...
This function will decode a MIME file.
This function is automatically called when receiving or loading a MIME encoded message. This function never needs to be called.
Parameters:
Return value:
Always 0.
Example: Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
objEMailMessage.Decode
...
This function loads a MIME encoded e-mail from file.
Parameters:
Return value:
Always 0.
Example: Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
objEMailMessage.LoadMIME "C:\Temp\Test.mime"
If objEMailMessage.LastError <> 0 Then
WScript.Echo "Error: " & objEMailMessage.GetErrorDescription(objEmailMessage.LastError)
End If
...
This function saves a MIME encoded file
Parameters:
Return value:
Always 0.
Example: Set objEMailMessage = CreateObject("ActiveEmail.EMailMessage")
...
objEMailMessage.SaveMIME "C:\Temp\Test.mime"
If objEMailMessage.LastError <> 0 Then
WScript.Echo "Error: " & objEMailMessage.GetErrorDescription(objEmailMessage.LastError)
End If
...
In the ActiveEmail, all e-mail constants are grouped together in a separate object called EMailConstants. First create the constants object before you can actually use the constants:
Set objConstants = CreateObject( "ActiveEmail.EMailConstants" ) ... WScript.Echo objConstants.EMAIL_MESSAGE_PRIORITY_HIGHEST WScript.Echo objConstants.EMAIL_MESSAGE_PRIORITY_HIGH WScript.Echo objConstants.EMAIL_MESSAGE_PRIORITY_MEDIUM WScript.Echo objConstants.EMAIL_MESSAGE_PRIORITY_LOW WScript.Echo objConstants.EMAIL_MESSAGE_PRIORITY_LOWEST ...
| Constant | Value | Description |
| EMAIL_MESSAGE_PRIORITY_HIGHEST | Highest priority | |
| EMAIL_MESSAGE_PRIORITY_HIGH | High priority | |
| EMAIL_MESSAGE_PRIORITY_MEDIUM | Normal priority (default) | |
| EMAIL_MESSAGE_PRIORITY_LOW | Low priority | |
| EMAIL_MESSAGE_PRIORITY_LOWEST | Lowest priority |
| Constant | Value | Description |
| EMAIL_MESSAGE_ENCODING_DEFAULT | Uses the Operating System's current codepage | |
| EMAIL_MESSAGE_ENCODING_THAI | ISO-8859-11 encoding | |
| EMAIL_MESSAGE_ENCODING_JAPANESE | ISO-2022-jp encoding | |
| EMAIL_MESSAGE_ENCODING_CHINESE_SIMP | GB2312 encoding | |
| EMAIL_MESSAGE_ENCODING_KOREAN | KSC-5601 encoding | |
| EMAIL_MESSAGE_ENCODING_CHINESE_TRAD | BIG5 encoding | |
| EMAIL_MESSAGE_ENCODING_CENTRALEUROPE | ISO-8859-2 encoding | |
| EMAIL_MESSAGE_ENCODING_RUSSIAN | ISO-8859-5 encoding | |
| EMAIL_MESSAGE_ENCODING_WESTERN | ISO-8859-1 encoding | |
| EMAIL_MESSAGE_ENCODING_GREEK | ISO-8859-7 encoding | |
| EMAIL_MESSAGE_ENCODING_TURKISH | ISO-8859-3 encoding | |
| EMAIL_MESSAGE_ENCODING_HEBREW | ISO-8859-8 encoding | |
| EMAIL_MESSAGE_ENCODING_ARABIC | ISO-8859-6 encoding | |
| EMAIL_MESSAGE_ENCODING_BALTIC | ISO-8859-4 encoding | |
| EMAIL_MESSAGE_ENCODING_VIETNAMESE | WINDOWS-1258 encoding | |
| EMAIL_MESSAGE_ENCODING_UTF7 | UTF-7 encoding | |
| EMAIL_MESSAGE_ENCODING_UTF8 | UTF-8 encoding |
| Constant | Value | Description |
| SMTP_AUTH_AUTO | Auto detect (default) | |
| SMTP_AUTH_PLAIN | AUTH-PLAIN authentication | |
| SMTP_AUTH_LOGIN | AUTH-LOGIN authentication | |
| SMTP_AUTH_MD5CRAM | AUTH-CRAM-MD5 authentication |
| Constant | Value | Description |
| POP3_AUTH_AUTO | Auto detect (default) | |
| POP3_AUTH_PLAIN | AUTH-PLAIN authentication | |
| POP3_AUTH_APOP | APOP authentication |
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:
The ActiveEmail Queue Service is not installed by default. To install the ActiveEmail Queue Server service, you must do the following:
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:
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!
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.
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/smtp-pop3-component/.
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
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
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:
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.
You can use the Activate function of an object.
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.
You can activate the product by editing the registry manually:
For information about how to use the registration code with a Distribution License, please read the following document: How to distribute an ActiveXperts Toolkit.
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.
© 2011 ActiveXperts Software B.V.
contact@activexperts.com