October 24, 2016
Hot Topics:

Simple Email Client v1.

  • February 16, 2000
  • By Developer.com Staff
  • Send Email »
  • More Articles »

Using the SimpleEmailClient in dialog-based program


This ATL COM component provides very simple Internet email functionality (SMTP).


  • implement the basics of SMTP, as defined in RFC821 and RFC822,
  • send plain text email: no attachements, no MIME encoding,
  • support multiple recipients (separate email addresses with commas ','),
  • support multiple email servers (try next server if email cannot be delivered to a server),
  • provides automatic detection of SMTP server (resolve MX record in the DNS, using COMponent SimpleDNSResolver)
  • provide extended error information (ISupportErrorInfo and IErrorInfo are implemented),
  • provide very small executable: 44 Ko (MinSize) to 152 Ko (MinDependency)
  • require no Graphical User Interface: the component can be used in non-GUI applications, like a Windows NT Service.
  • run on Windows NT 4.0, Windows 95 and Windows 98
  • compile with VC++ 6.0 SP3


To use this component:
  • create an instance of the component,
  • call method SendEmail from interface ISimpleEmailClientX,
  • handle errors (try/catch in C++)


// Import smart pointer definition
#import "SimpleEmailClient.dll" no_namespace

// Create smart pointer object
ISimpleEmailClientXPtr pSimpleEmailClientX;

// ========================================================
// Initialize COM (This should be called at thread startup)
// ========================================================
HRESULT hResult = CoInitialize(NULL); 
if (FAILED(hResult)) {
 ErrorDialogBox("Cannot initialize COM: \n", hResult);
 return; // Failed

// ========================================================
// Create instance of the component to test
// ========================================================
 HRESULT hResult = S_OK;

 // Create object
 hResult = 

 if (FAILED(hResult)) {
  ErrorDialogBox("Cannot create component "
                 "Emmanuel.SimpleEmailClientX.1: \n", hResult);
catch (_com_error &e)
 ErrorDialogBox("Cannot create component "
                "Emmanuel.SimpleEmailClientX.1: \n", e);

// ========================================================
// Call method of component
// ========================================================
 HRESULT hResult = S_OK;

 hResult = 

 if (FAILED(hResult)) {
  ErrorDialogBox("Failure while executing method "
                 "SendMail: \n", hResult);
catch (_com_error &e)
 ErrorDialogBox("Failure while executing method SendMail: \n", e);

// ========================================================
// UnInitialize COM (This should be called at thread exit)
// ========================================================

Please refer to the demo project for a full example. Note that you should extract the demo project underneath the component project:



 Dim oSMTP

 Set oSMTP = CreateObject("Emmanuel.SimpleEmailClientX.1")

 oSMTP.SendEmail "me@mydomain.com", "you@yourdomain.com", 
  "My Subject", "My Text...", "myserver.domain.com"

Please refer to the test HTML file "TestSimpleEmailClient.htm" for a full VBSsript example (see GUI below)

Using the SimpleEmailClient in dialog-based programUsing the SimpleEmailClient in Internet Explorer


This component relies on two MFC-related C++ class:
  • CSimpleSocket: an extension of MFC class CSocket providing text and timer features
  • CSimpleSMTPClient: a C++ class implementing a SMTP client.

You can integrate these classes in your application if you don't want to use the component.

If the COMponent "Emmanuel.SimpleDNSClient" is installed on your machine, it will be used to find the name of you SMTP server(s) as registered in the DNS. You will not need to provide a SMTP name as the 5th parameter of method SendEmail (just put an empty string). Please refer to the SimpleDNSClient documentation (www.kartmann.com/emmanuel) for details.


  • Support attachments
  • Support binary data (MIME encoding)
  • Support additional SMTP headers (Reply-To, Cc, Bcc, etc...)
  • Support ESMTP


Download self-extracting executable - 120 Kb
Download source - 143 Kb

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Thanks for your registration, follow us on our social networks to keep up-to-date
Rocket Fuel