⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.htm

📁 email收发软件例子源代码
💻 HTM
字号:

<h3 align="center"><font color="#AOAO99">

Simple Email Client v1.3

</font></h3>

<P><hr></P>

<P>Author: <a href="mailto:emmanuel@kartmann.com">Emmanuel KARTMANN</a>.</P>

<P>
Creation Date: November 28th, 1998<BR>
Last Modification Date: February 8th, 2000
</P>

<P><hr></P>

<p><CENTER><img src="SimpleEmailClient1.jpg" alt="Using the SimpleEmailClient in dialog-based program"></CENTER></p>

<h3>OVERVIEW</h3>

<P>
This ATL COM component provides very simple Internet email functionality (SMTP).
</P>



<h3>FEATURES</h3>

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


<h3>USAGE</h3>

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



<h3>SAMPLE CODE (VC++)</h3>

<pre><font color="#990000"><tt>
    // 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
    // =======================================================================
    try 
    {
        HRESULT hResult = S_OK;
        // Create object
        hResult = pSimpleEmailClientX.CreateInstance("Emmanuel.SimpleEmailClientX.1");
        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
    // =======================================================================
    try 
    {
        HRESULT hResult = S_OK;
        hResult = pSimpleEmailClientX->SendEmail(_bstr_t(m_szFrom), _bstr_t(m_szTo), _bstr_t(m_szSubject), _bstr_t(m_szBody), _bstr_t(m_szServerName));
        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)
    // =======================================================================
    CoUninitialize(); 
</tt></font></pre>


<P>Please refer to the demo project for a full example. Note that you should extract the demo project underneath
the component project:</P>
<UL>
	SimpleEmailClient\
	<UL>
		TestSimpleEmailClient\
	</UL>
</UL>



<h3>SAMPLE CODE (VBScript)</h3>

<pre><font color="#990000"><tt>
	Dim oSMTP

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

	oSMTP.SendEmail "me@mydomain.com", "you@yourdomain.com", "My Subject", "My Text...", "myserver.domain.com"
</tt></font></pre>


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

<p><CENTER><img src="SimpleEmailClient2.jpg" alt="Using the SimpleEmailClient in Internet Explorer"></CENTER></p>



<h3>IMPLEMENTATION</h3>

This component relies on two MFC-related C++ class:
<UL>
	<LI><A HREF="SimpleSocket.h">CSimpleSocket</A>: an extension of MFC class CSocket providing text and timer features
	<LI><A HREF="SimpleSMTPClient.h">CSimpleSMTPClient</A>: a C++ class implementing a SMTP client.
</UL>

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

<P>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 
(<A HREF="http://www.kartmann.com/emmanuel">www.kartmann.com/emmanuel</A>) for details.</P>


<h3>TO DO LIST</h3>

<UL>
	<LI>Support attachments
	<LI>Support binary data (MIME encoding)
	<LI>Support additional SMTP headers (Reply-To, Cc, Bcc, etc...)
	<LI>Support ESMTP
</UL>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -