Simple Mail Transfer Protocol

The SocketTools Simple Mail Transfer Protocol (SMTP) control enables an application to easily send e-mail messages to one or more recipients using a standard protocol implemented by a wide variety of servers. The control supports both basic SMTP and Extended SMTP (ESMTP), with advanced features such as security, delivery status notification and authentication. To download a free evaluation copy of SocketTools or for more information about this component, please select one of the following links:

Control Overview

The Simple Mail Transfer Protocol (SMTP) enables applications to deliver e-mail messages to one or more recipients. The control provides an interface for addressing and delivering messages, and extended features such as user authentication and delivery status notification. Unlike Microsoft’s Messaging API (MAPI) or Collaboration Data Objects (CDO), there is no requirement to have certain third-party e-mail applications installed or specific types of servers installed on the local system. The SocketTools control can be used to deliver mail through a wide variety of systems, from standard UNIX based mail servers to Windows systems running Exchange or Lotus Notes and Domino. Using the SocketTools control, messages can be delivered directly to the recipient, or they can be routed through a relay server, such as an Internet Service Provider’s mail system. The Mail Message control can be integrated with this control in order to provide an extremely simple, yet flexible interface for composing and delivering mail messages.

This control supports secure connections using the standard SSL and TLS protocols. Both implicit and explicit SSL connections can be established, enabling the control to work with a wide variety of servers. A SocketTools Secure Visual Edition license must be purchased to use the security features in this library.

Control Features

The following are just some of the features in the SocketTools Simple Mail Transfer Protocol control:

  • Standard ATL based ActiveX control compatible with most languages
  • Low resource utilization and no external dependencies on third-party libraries
  • Fully compatible with Visual Studio .NET languages
  • Includes both high level and lower level interfaces for maximum flexibility
  • Includes support for protocol extensions and custom commands
  • Support for both standard SMTP and Extended SMTP (ESMTP) options
  • User authentication is fully supported, enabling an application to relay messages
  • Support for both synchronous and asynchronous network connections
  • Thread-safe implementation with full support for multithreaded applications
  • An extensive Developer's Guide and online Technical Reference
  • A professional technical support staff and extensive online support resources
  • No runtime licensing fees or additional royalties
  • A trusted company with over 10 years experience developing Internet components

Code Example

The following code example in Visual Basic demonstrates how the control can be used to deliver a pre-composed message through an SMTP server. The message itself is contained in a string variable.

' Connect to the mail server, specifying that extended options (ESMTP)
' should be used if possible
nError = SmtpClient1.Connect(strHostName, Options := smtpOptionExtended)
If nError <> 0 Then
    MsgBox SmtpClient1.LastErrorString, vbExclamation
    Exit Sub
End If

' Authenticate the current user; typically this enables a user
' to relay messages through that server
nError = SmtpClient1.Authenticate(strUserName, strPassword)
    If nError <> 0 Then
    MsgBox SmtpClient1.LastErrorString, vbExclamation
    Exit Sub
End If

' Deliver the message, stored as a string in the strMessage variable,
' to the specified recipient
nError = SmtpClient1.SendMessage(strSender, _
                                 strRecipient, _
                                 strMessage)

If nError <> 0 Then
    MsgBox SmtpClient1.LastErrorString, vbExclamation
End If

' Disconnect from the mail server
SmtpClient1.Disconnect

In this example, there are four methods that are called: Connect, which establishes the connection to the mail server; Authenticate which authenticates the current user by providing the server with a username and password; SendMessage which submits the message to the server for delivery; and Disconnect, which closes the connection to the server.

As you can see, most of the code is actually related to error checking and comments, with only a few lines of code required to connect and submit the message to the server. Note that it is not always necessary to authenticate the user to the mail server, in which case the Authenticate method call could be omitted.

SocketTools Links

Product Overview
An overview of the product features and benefits.


SocketTools Controls
The ActiveX controls that are included with this edition.


Frequently Asked Questions
Answers to the most common questions about SocketTools.


Download Product
Download a free evaluation copy of SocketTools.


Purchase Online
Purchase a developers license for this product.


Technical Reference
Review the online technical reference documentation.


Release Notes
Release notes for the current version of SocketTools.


License Agreement
The developer license agreement for this product.