Documentation
Installation
After download unzip the contents of the e2esmtp.zip file and run setup.exe. Specify an installation folder and follow the instructions to complete the installation.

After installation you must run the easy2email config utility (from Start - Programs - easy2email) and select the Component tab. On the Component tab select the ActiveX DLL in COM+ Package option, specify a user with sufficient rights (Administrator recommended) and select if you want the logging feature to be available to users of the component.

After adding the component to the COM+ package you can test if the component is working properly by selecting the Testing tab. The component can then be tested as follows:
  • Select an IIS virtual web server from the virtual web server dropdown box.
  • Select a virtual directory from the virtual directory dropdown box, you can also specify a new virtual directory by typing its name.
  • Click the Create and Point button which will map the samples folder to the selected virtual directory.
  • Click the Test in Browser button which will launch your default browser dispalying a test page.
  • Specify the necessary details and click Send Message to view the results of sending a test message.
A sample web page (called sample.asp) is also available in the Samples folder of where you installed easy2email. Additional samples are also available on the easy2email web site.

A Logdata folder is also created of the easy2email installation folder containing a sample Microsoft Access database and UDL file to use when logging to ADODB. For security purposes it is recommended that you copy these files to a directory that is not accessible with a web browser if you want to enable the logging to ADODB feature. Please see the FAQ section on this site for more info on logging.


Uninstallation
Important If you need to uninstall the easy2email SMTP component run the easy2email config utility (from Start - Programs - easy2email) and select the Component tab. On the Component tab select the Not Registered option to remove the easy2email COM+ package and click OK to exit. Then run Add/Remove Programs from the Windows Control Panel and remove the item easy2email SMTP. In addition you may want to remove the easy2email installation folder with Windows Explorer.

Basic Email Messaging
Sending email messages with the easy2email requires the following steps (in the web page):
1. Create an easy2email SMTP object.
2. Enable logging of the object's activities.
3. Set up the necessary connection properties (SMTP host, port number etc.).
4. Connect to the mail server and check if the connection was successful.
5. If the mail server requires authentication specify details, authenticate and check if successful.
6. Set up the details of the email message(s) to b sent (subject, body, recipient(s), CC recipients etc.).
7. Send the email message(s).
8. Disconnect.
9. Free the easy2email SMTP object.

Creating the easy2email SMTP object
From an ASP page create the easy2email SMTP component as follows:

<%
.....
Set Mail = Server.CreateObject("easy2email.SMTP")
.....
%>

From a VB or other early binding programming environments you need to add or import the easy2email library. VB code are shown below:

Dim Mail As easy2email.SMTP
Set Mail = New easy2email.SMTP

If you receive an error with the above statement it is most likely that you did not run the easy2email config utility after installation. The problem can also be related to rights or permissions. Note that the rest of this documentation will only show ASP code as the VB and ASP code are similar.


Enable logging
As an option you can enable logging which means all connection, authentication, sending and disconnecting attempts by the easy2email component will be logged.

By default logging is disabled. To enable logging call the SetLogging method with either the lgText or lgADODB parameter. The LoggingDestination property (which must be set up before the call to SetLogging) indicates the logging destination. If logging to a text file is required the LoggingDestination property points to the name of a text file where the easy2email component will log to. If logging to a ADODB is required the LoggingDestination property points to the name of a UDL file (which contains the database connection properties) where the easy2email component will log to. Please see the FAQ section on this site for more information on logging to ADODB.


<%
.....
Mail.IgnoreLoggingExceptions = True
Mail.LoggingDestination = "c:\logdata\logfile.txt"
Mail.SetLogging lgText
.....
%>

Setting up the Connection Properties
You need to set up the Host property, which is the IP address or DNS host name of the SMTP mail server. Optionally if you are not using the default port 25 for SMTP you may set the Port property to the TCP port your SMTP mail server is running on.

<%
.....
Mail.Host = "mail.mydomain.com"
Mail.Port = 25
.....
%>

Connecting to the Mail Server
After you specified the connection properties use the Connect method to connect to the mail server and test the result of the connection attempt.

<%
.....
ConnectResult = Mail.Connect
.....
%>

The Connect method will return True if the connection was successful or False if the connection attempt failed. In the above call ConnectResult will hold the result of the call.

Authenticating to the Mail Server
Upon successful connection and if the mail server requires it you use the Authenticate method to autenticate to the mail server and test the result of the authentication attempt.

<%
.....
Mail.Username = "johns"
Mail.Password = "password"
AuthenticateResult = Mail.Authenticate
.....
%>

The Authenticate method will return True if authentication was successful or False if the authentication failed. In the above call AuthenticateResult will hold the result of the call.

Preparing and Sending the Message
Before sending the email message the necessary properties (for instance the name and email address of the author, the name and email address of the receiver, the subject and body) need to be set up. Use the FromName and FromEMail properties to specify the author of the message. Use the AddRecipient method to add message recipient(s) and the AddCCRecipient and AddBCCRecipient methods to add carbon copy and blank carbon copy recipients.

The Subject property needs to be set up to contain the subject of the email message. Set up the ContentType of the body to indicate the mime type of the message body. The Body property needs to be set up to contain the body of the email message. The body is set up to relate to what was specified for the ContentType property. For instance if the ContentType is set to text/html then HTML markup will be interpreted when the body is processed by the receiving mail client application.

Optionally per message you can set up the LogReferenceID property which is a reference value (that has meaning to you) that will be logged when logging to a text file or ADODB is enabled.

Finally call the Send method to send the email message and check the result with the Err object. You can call the Send method multiple times after connecting and authenticating. Please remember that all fields (for instance recipients, body etc.) needs to be set up again as the Send command clears these values after the message has been sent.

<%
.....
Mail.ContentType = "text/plain"
Mail.Priority = mpNormal
Mail.FromEmail = "johnsmith@somedomain.com"
Mail.FromName = "John Smith"
Mail.AddRecipient "joebloggs@anotherdomain.com", "Joe Bloggs"
Mail.Subject = "A test message"
MailBody = "A simple plain text message" & vbCrLf
Mail.Body = MailBody
Mail.LogReferenceID = "BLO00123"
Mail.Send
If Err <> 0 Then
  Response.Write "<li><p>Send Error, Description: " & Err.Description & "</p>"
Else
  Response.Write "<li><p>Message sent to " + RecipientName + "</p></li>"
End If
.....
%>

Disconnecting from the Mail Server
After all the messages has been sent use the Disconnect method to disconnect from the mail server.

<%
.....
Mail.Disconnect
.....
%>

Free the Mail Object
Free the memory used by the mail object.

<%
.....
Set Mail = Nothing
.....
%>

Using the component with ASP.NET
Version 1.0.2.x (released May 24, 2005) and later includes a COM wrapper for using the component from an ASP.NET page. The wrapper is contained in the file easy2emaildn.dll available in the installation folder of the component. Please refer to the Samples page for a complete ASP.NET sample.

<%
.....
Set Mail = Nothing
.....
%>

Object Reference
.
Property/Method Description
method AddAttachment(FileName, ContentType) Adds a file attachment to the message. More than one attachment can be added by calling this method multiple times.
Parameters:
  FileName - string - name of the file - required, for instance c:\myfiles\abc.gif
  ContentType - string - mime type of file - for instance image/jpg - optional - recommended leave empty
Return Value
  None
method Authenticate Authenticates to mail server after connection has been established with the Connect method. Set up Username and Password properties before calling this method.
Parameters:
  None
Return Value
  Autentication result - boolean (True/False).
method Connect Connects to SMTP mail server. Set up Host property before calling this method.
Parameters:
  None
Return Value
  Connection result - boolean (True/False).
method AddBCCRecipient(EmailAddress, Name) Adds a blank carbon copy (BCC) receipient for the message. More than one BCC recipient can be added by calling this method multiple times..
Parameters:
  EmailAddress - string - email address of the BCC recipient - required, for instance john@domin.com. The difference between a CC and BCC recipient is that there is no way that a recipient and a CC recipient can see that the message was sent to a BCC recipient.
  Name - string - name of BCC recipient - for instance John Smith - optional.
Return Value
  None
method AddCCRecipient(EmailAddress, Name) Adds a carbon copy (CC) receipient for the message. More than one CC recipient can be added by calling this method multiple times.
Parameters:
  EmailAddress - string - email address of the CC recipient - required, for instance john@domin.com.
  Name - string - name of CC recipient - for instance John Smith - optional.
Return Value
  None
method AddReceiptRecipient(EmailAddress, Name) Adds a receipt receipient for the message. Specifying a receipt recipient will trigger some email client programs (like Microsoft Outlook) to put an automatic reply message in the Outbox for sending to indicate to the receipt recipient that the message has been read. Only one receipt recipient can be specified.
Parameters:
  EmailAddress - string - email address of the receipt recipient - required, for instance john@domin.com.
  Name - string - name of receipt recipient - for instance John Smith - optional.
Return Value
  None
method AddRecipient(EmailAddress, Name) Adds a recipient for the message. More than one recipient can be added by calling this method multiple times.
Parameters:
  EmailAddress - string - email address of the recipient - required, for instance john@domin.com.
  Name - string - name of recipient - for instance John Smith - optional.
Return Value
  None
method AddReplyTo(const EmailAddress: WideString; const Name: WideString) Adds a reply to address for the message to use when the recipient(s) decide(s) to reply to the message. More than one reply to address can be added by calling this method multiple times.
Parameters:
  EmailAddress - string - email address to reply to - required, for instance john@domin.com.
  Name - string - name to reply to - for instance John Smith - optional.
Return Value
  None
method Disconnect Disconnects from the SMTP mail server
Parameters:
  None
Return Value
  None
method GetVersion Gets the version of the easy2email DLL
Parameters:
  None
Return Value
  The version, for instance 1.0.0.289.
method Send Send an email message through a SMTP mail server
Parameters:
  None
Return Value
  None
method SendToFile(FileName) Saves an email message to a file. V1.0.2 and later only. No need to use the Connect and Authenticate methods when sending to file. This method is useful to save a message to a file to be picked up by a mail server scanning the folder.
Parameters:
  FileName - string - The complete filename, for instance:
  "c:\mailfiles\myfile.eml" or
  Server.Mappath(".") & "\myfile.eml".
Return Value
  None
method SetLogging(LoggingType) Enable or disable logging of the activities of the easy2email component.
Parameters:
  LoggingType - enumerated - either lgNone, lgText or lgADODB.
  lgNone disables logging.
  lgText enables logging to a text file. To use this option the LoggingDestination property has to be set to   the name of the text file to log to.
  lgADODB enables logging to ADODB (for instance Access, SQL Server etc). To use this option the
  LoggingDestination property has to be set to the name of a udl file that contains the connection
  properties of the ADODB connection. See the FAQ section formore on udl files.
Return Value
  None 
property Body The body of the message to send - string.
property CharSet The character set to use when sending the message, for instance ISO-8859-1 - string.
property ContentTransferEncoding The content transfer encoding to use, for instance base64 - string.
property ContentType The mime type of the message body, for instance text/plain - string.
property FromEmail The email address of the author of the message - string.
property FromName The name of the author of the message - string.
property Host The DNS host name or IP address of the SMTP mail server - string.
property IgnoreLoggingExceptions This property tells the easy2email component whether to ignore exceptions that occurred due to logging problems - boolean (True/False).
property LoggingDestination The destination to log to, see SetLogging method - string.
property LogReferenceID A value logged when a message is sent that has meaning to the sender, for instance an order number - string.
property Password The password to use when authenticating to the mail server - string.
property Port The TCP port number to connect on - integer.
property Priority The priority of the message to send - enumerated - mpHighest, mpHigh, mpNormal, mpLow or mpLowest.
property Subject The subject of the email message - string.
property Username The username to use when authenticating to the mail server - string.



Other links
For additional information please also visit:
Sample use of the component
Frequently Asked Questions
Technical Support
Product information
Buy an easy2email product
   
Home|Contact Us|Useful Links||Disclaimer  
 ©2007 easy2email. All rights reserved.