Simple Email Client v1.0 | CodeGuru

Simple Email Client v1.0

Environment: VC6 SP5, Windows 2000 (used to work VC6 SP3, NT 4.0/Win95/Win98) OVERVIEW This ATL COM component provides very simple Internet email functionality (SMTP). FEATURES implements the basics of SMTP, as defined in RFC821 and RFC822, sends plain text email: no attachements, no MIME encoding, supports multiple recipients (separate email addresses with commas ‘,’), supports […]

Written By
CodeGuru Staff
CodeGuru Staff
Oct 18, 2001
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Environment: VC6 SP5, Windows 2000 (used to work VC6 SP3, NT 4.0/Win95/Win98)

OVERVIEW


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

FEATURES


  • implements the basics of SMTP, as defined in
    RFC821 and
    RFC822,
  • sends plain text email: no attachements, no MIME encoding,
  • supports multiple recipients (separate email addresses with commas ‘,’),
  • supports 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)
  • provides extended error information (ISupportErrorInfo and IErrorInfo are implemented),
  • is safe for scripting (IObjectSafety is implemented),
  • provides very small executable: 44 Ko (MinSize) to 152 Ko (MinDependency)
  • requires no Graphical User Interface: the component can be used in non-GUI applications,
    like a Windows NT Service.
  • runs on Windows 2000 (originally on NT 4.0, Windows 95 and Windows 98)
  • compiles with VC++ 6.0 SP3
Advertisement

USAGE

To use this component:


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

SAMPLE CODE (VC++)

    #import "SimpleEmailClient.dll" no_namespace

    ISimpleEmailClientXPtr pSimpleEmailClientX;

    HRESULT hResult = CoInitialize(NULL);

    hResult = pSimpleEmailClientX.CreateInstance("Emmanuel.SimpleEmailClientX.1");

    hResult = pSimpleEmailClientX->SendEmail(_bstr_t("me@mydomain.com"),
                                             _bstr_t("you@yourdomain.com"),
                                             _bstr_t("My Subject"),
                                             _bstr_t("My Text..."),
                                             _bstr_t("myserver.domain.com"));

    CoUninitialize();

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



    SimpleEmailClient\

      TestSimpleEmailClient\

SAMPLE CODE (VBScript)

  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 Internet Explorer>

IMPLEMENTATION

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.org) for details.

Advertisement

TO DO LIST


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

Downloads

Download demo project – 122 Kb

Download source – 147 Kb

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.