?? pop3.htm
字號:
<html>
<head>
<title>CPop3Connection v1.19</title>
</head>
<body>
<p align="left"><img src="pop3.gif" width="40" height="40"><font face="Arial"><strong><big><big><big><big>CPop3Connection
v1.19</big></big></big></big></strong></font></p>
<p><font face="Arial">Welcome to <strong>CPop3Connection</strong>, a freeware MFC class to
support the POP3 protocol. POP3 for those not familiar with all the internet protocols is
the protocol used to retrieve internet email. </font></p>
<p><font face="Arial">For detailed information about the <strong>P</strong>ost <strong>O</strong>ffice
<strong>P</strong>rotocol Version <strong>3</strong> you should read RFC 1725.
You should also refer to RFC 822 which contains details on the layout of
messages.</font></p>
<p><font face="Arial">You can find numerous Web Servers which carry these documents by
going to <a href="http://www.yahoo.com">www.yahoo.com</a> and look for RFC and
1725 or 822. </font></p>
<p> </p>
<p> </p>
<table>
<tr>
<td><font face="Arial"><a href="#Features">Features</a></font></td>
</tr>
<tr>
<td><font face="Arial"><a href="#Usage">Usage</a></font></td>
</tr>
<tr>
<td><font face="Arial"><a href="#History">History</a></font></td>
</tr>
<tr>
<td><font face="Arial"><a href="#APIReference">API Reference</a></font></td>
</tr>
<tr>
<td><font face="Arial"><a href="#Enhancements">Planned Enhancements</a></font></td>
</tr>
<tr>
<td><font face="Arial"><a href="#Contact">Contacting the Author</a></font></td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p><font face="Arial"><a name="Features"></a><big><strong><big>Features</big></strong></big>
</font>
<ul>
<li><font color="#000000" size="3" face="Arial">Simple and clean C++ interface.</font></li>
<li><font color="#000000" size="3" face="Arial">The interface provided is synchronous which
provides an easier programming model than using asynchronous sockets.</font></li>
<li><font color="#000000" size="3" face="Arial">The code does not rely on the MFC socket
classes. These classes have a number of shortcomings, one of which causes problems when
they are used in NT services.</font></li>
<li><font color="#000000" size="3" face="Arial">The code can be used in a console
application without any problems (Again this is not the case for the MFC socket classes).</font></li>
<li><font color="#000000" size="3" face="Arial">A configurable timeout for the connection
can be set through the class API.</font></li>
</ul>
<p> </p>
<p> </p>
<p> </p>
<p><a name="Usage"></a><font face="Arial"><big><big><strong>Usage</strong></big></big></font>
<ul>
<li><font color="#000000" size="3" face="Arial">To use the class in your code simple include
pop3.cpp in your project and #include pop3.h in which ever of your modules needs to make
calls to the class. </font></li>
<li><font face="Arial">To see the class in action, have a look at the code in InitInstance
in the module "main.cpp". </font></li>
<li><font face="Arial">Your code will need to include MFC either statically or dynamically.</font></li>
<li><font face="Arial">You will need to have a functioning Winsock stack installed and
correctly initialized prior to calling any functions in CPop3Connection. Depending on your
application, this will involve calling either WSAStartup or AfxSocketInit at startup of
your application.</font></li>
<li><font face="Arial">You will also need to have afxtempl.h and winsock.h or afxsock.h in
your precompiled header. The code will work just aswell in a GUI or console app. The code
should also work in a multithreaded application, although it has not be explicitly tested
in this scenario.</font></li>
</ul>
<p> </p>
<p> </p>
<p> </p>
<p><font face="Arial"><big><a name="History"></a></big><font color="#000000" size="5"><strong>History</strong></font></font></p>
<p><strong><font color="#000000" size="3" face="Arial">V1.0 (18th M</font><font
face="Arial"><font size="3"><font color="#000000">ay</font></font><font color="#000000"
size="3"> 1998)</font></strong> </font>
<ul>
<li><font face="Arial" color="#000000" size="3">Initial public release.</font></li>
</ul>
<p><strong><font face="Arial" color="#000000" size="3">V1.1 (28th June</font><font
face="Arial"><font color="#000000" size="3"> 1998)</font></strong> </font>
<ul>
<li><font face="Arial">Fixed a potential buffer overflow problem in Delete and Retrieve
functions when a large message number was specified.</font></li>
<li><font face="Arial">Improve the ReadResponse code by</font></li>
<li><font face="Arial"> a) passing the readability check onto the socket
class and </font></li>
<li><font face="Arial"> b) Sleeping for 100 ms prior to looping around
waiting for new response data</font></li>
<li><font face="Arial">Classes are now fully Unicode compliant. Unicode build configurations
are also now included.</font></li>
<li><font face="Arial">Now supports the TOP POP3 command which can be issued using the
GetHeader function.</font></li>
<li><font face="Arial">Fixed a few typos in the documentation.</font></li>
</ul>
<p><strong><font face="Arial" color="#000000" size="3">V1.11 (4th January 1999</font><font
face="Arial"><font color="#000000" size="3">)</font></strong> </font>
<ul>
<li><font face="Arial">Minor update to the documentation.</font></li>
<li><font face="Arial">Now includes VC 5 workspace files as standard.</font></li>
<li><font face="Arial">Properly Unicode enabled all the code as previously the code exposes
an Ascii(LPSTR/LPCSTR) API instead of a TCHAR / CString API.</font></li>
</ul>
<p><strong><font face="Arial" color="#000000" size="3">V1.12 (22nd February 1999</font><font
face="Arial"><font color="#000000" size="3">)</font></strong> </font>
<ul>
<li><font face="Arial">Default timeout for the code when a debug build is built has now been
set to 60 seconds.</font></li>
<li><font face="Arial">Improved the reading of responses back from the server by
implementing a growable receive buffer.</font> </li>
<li><font face="Arial">Updated instructions on how the relevant RFC documents can be
retrieved.</font></li>
</ul>
<p><strong><font face="Arial" color="#000000" size="3">V1.13 (25th March 1999</font><font
face="Arial"><font color="#000000" size="3">)</font></strong> </font>
<ul>
<li><font face="Arial">Fixed a memory leak in the CPop3Connection::ReadReturnResponse
function.</font></li>
<li><font face="Arial">Now sleeps for 250 ms instead of yielding the time slice. This helps
reduce CPU usage when waiting for data to arrive in the socket</font></li>
</ul>
<p><strong><font face="Arial" color="#000000" size="3">V1.14 (15th June 1999)</font></strong>
<ul>
<li><font face="Arial">Added functions to return the message body, header or a particular header
field of a message.</font></li>
<li><font face="Arial">Tidied up some of the TRACE messages which the code generates.</font></li>
<li><font face="Arial">Fixed some typos and spelling mistakes in this file.</font></li>
</ul>
<p><strong><font face="Arial" color="#000000" size="3">V1.15 (16th June 1999)</font></strong>
<ul>
<li><font face="Arial">Fixed a bug in the GetHeaderItem function which was causing a header
item which appeared at the beginning of the header fields to fail to be parsed
incorrectly.</font></li>
</ul>
<p><strong><font face="Arial" color="#000000" size="3">V1.16 (27th June 1999)</font></strong>
<ul>
<li><font face="Arial">Fixed a bug in the GetHeaderItem function when a header spanned multiple lines as is allowed by RFC 822.</font></li>
</ul>
<p><strong><font face="Arial" color="#000000" size="3">V1.17 (29th June 1999)</font></strong>
<ul>
<li><font face="Arial"> Another improvement to GetHeaderItem. When will it end <g>. Originally this was reported as a bug but upon further investigation it turns out that
the message which was causing the problems had embedded tabs in the header. This is discouraged by the RFC which refers to mail headers (RFC 822). The code has been enhanced to handle this case. Thanks to Chris Bishop for spotting this.</font></li>
<li><font face="Arial">Fix for a bug in GetHeaderItem where I accidentally was using "=" instead of
"==". Thanks to Angelini Fabio for spotting this.</font></li>
<li><font face="Arial">Updated documentation to refer to RFC 822.</font></li>
</ul>
<p><strong><font face="Arial" color="#000000" size="3">V1.18 (5th July 1999)</font></strong>
<ul>
<li><font face="Arial">Addition of the following functions:<br>
i) CPop3Message::GetReplyTo()<br>
ii) CPop3Message::GetRawBody <br>
iii) CPop3Message::GetSubject <br>
iv) CPop3Message::GetFrom <br>
v) CPop3Message::GetDate </font></li>
<li><font face="Arial">GetHeaderItem function now uses case insensitive searching.</font></li>
<li><font face="Arial">GetHeaderItem now allows you to search for the "n'th" header of a specified type.</font></li>
</ul>
<p><strong><font face="Arial" color="#000000" size="3">V1.19 (24th August 1999)</font></strong>
<ul>
<li><font face="Arial">Fixed a bug whereby the function GetHeader was sometimes failing when it
was called when the message was retrieved using the "TOP" command.</font></li>
</ul>
<p> </p>
<p> </p>
<p> </p>
<p class="crt"><font face="Arial"><a name="APIReference"></a><big><big><strong>API
Reference</strong></big></big></font></p>
<p><font face="Arial">The API consists of the public member functions of the class
CPop3Connection & CPop3Message</font></p>
<p><font face="Arial"><a href="#Connect">CPop3Connection::Connect<br>
</a><a href="#Disconnect">CPop3Connection::Disconnect<br>
</a><a href="#Statistics">CPop3Connection::Statistics<br>
</a><a href="#Delete">CPop3Connection::Delete<br>
</a><a href="#GetMessageSize">CPop3Connection::GetMessageSize</a><br>
<a href="#GetMessageID">CPop3Connection::GetMessageID</a><br>
<a href="#Retrieve">CPop3Connection::Retrieve<br>
</a><a href="#Reset">CPop3Connection::Reset<br>
</a><a href="#UIDL">CPop3Connection::UIDL</a><br>
<a href="#GetMessageHeader">CPop3Connection::GetMessageHeader<br>
</a><a href="#Noop">CPop3Connection::Noop<br>
</a><a href="#GetLastCommandResponse">CPop3Connection::GetLastCommandResponse<br>
</a><a href="#GetTimeout">CPop3Connection::GetTimeout<br>
</a><a href="#SetTimeout">CPop3Connection::SetTimeout<br>
</a><a href="#GetMessageText">CPop3Message::GetMessageText
</a></font><a href="#GetMessageText"><br>
</a><font face="Arial"><a href="#GetHeaderItem">CPop3Message::GetHeader</a></font><a href="#GetMessageText"><br>
</a><font face="Arial"><a href="#GetHeaderItem">CPop3Message::GetHeaderItem</a></font><a href="#GetMessageText"><br>
</a><font face="Arial"><a href="#GetHeaderItem">CPop3Message::GetBody<br>
</a></font><font face="Arial"><a href="#GetReplyTo">CPop3Message::GetReplyTo</a><br>
<a href="#GetRawBody">CPop3Message::GetRawBody</a><br>
<a href="#GetSubject">CPop3Message::GetSubject</a><br>
<a href="#GetDate">CPop3Message::GetFrom</a><br>
<a href="#GetDate">CPop3Message::GetDate</a></font></p>
<p> </p>
<p> </p>
<p><a name="Connect"></a><big><strong><font face="Arial">CPop3Connection::Connect</font></strong></big></p>
<p><font face="Arial"><strong>BOOL CPop3Connection::Connect(LPCSTR </strong><em>pszHostName</em><strong>,
LPCSTR </strong><em>pszUser</em><strong>, LPCSTR </strong><em>pszPassword</em><strong>,
int </strong><em>nPort</em><strong> = 110);</strong></font></p>
<p class="rl"><strong><font face="Arial">Return Value</font></strong></p>
<p class="t"><font face="Arial">If the function succeeds, the return value is TRUE. If the
function fails, the return value is FALSE. To get extended error information, call
::GetLastError.</font></p>
<p><font face="Arial"><strong>Parameters</strong></font></p>
<p><font face="Arial"><em>pszHostName</em> The network address of the socket to connect
to: a machine name such as “mail.yourisp.com”, or a dotted number such as
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -