Environment: VC6 SP5, Windows 2000 (used to work VC6 SP3, NT 4.0/Win95/Win98)
- 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
USAGETo 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("email@example.com"), _bstr_t("firstname.lastname@example.org"), _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:
SAMPLE CODE (VBScript)
Dim oSMTP Set oSMTP = CreateObject("Emmanuel.SimpleEmailClientX.1") oSMTP.SendEmail "email@example.com", "firstname.lastname@example.org", "My Subject", "My Text...", "myserver.domain.com"
Please refer to the test HTML file "TestSimpleEmailClient.htm" for a full VBSsript example (see GUI below)
IMPLEMENTATIONThis 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.
TO DO LIST
- Support attachments
- Support binary data (MIME encoding)
- Support additional SMTP headers (Reply-To, Cc, Bcc, etc...)
- Support ESMTP
DownloadsDownload demo project - 122 Kb
Download source - 147 Kb