📄 pop3.htm
字号:
<html>
<head>
<title>CPop3Connection v1.11</title>
</head>
<body>
<p align="left"><img src="pop3.gif" width="40" height="40"><font face="Arial"><big><big><big><big><strong>CPop3Connection
v1.11</strong></big></big></big></big></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 can
download this from <a href="ftp://ds.internic.net/rfc/rfc1725.txt">ftp://ds.internic.net/rfc/rfc1725.txt</a>.
If this server is unavailable, try <a href="ftp://venera.isi.edu/in_notes/">ftp://venera.isi.edu/in_notes/</a></font></p>
<p> </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 initialised 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 color="#000000" size="3" face="Arial">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> </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</font><br>
</a></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
“128.56.22.8”.</font></p>
<p><font face="Arial"><em>pszUser</em> This is the POP3 user name of the mailbox.</font></p>
<p><font face="Arial"><em>pszPassword</em> This is the password for the POP3 mailbox.</font></p>
<p><font face="Arial"><em>nPort</em> This is the port number on which to connect. The
default value is 110 which is the default POP3 port number.</font></p>
<p><font face="Arial"><strong>Remarks</strong></font></p>
<p><font face="Arial">Call this member function to establish a connection to a POP3
mailbox.</font></p>
<p><strong><font face="Arial">See Also</font></strong></p>
<p><a href="#Disconnect"><font face="Arial">CPop3Connection::Disconnect</font></a></p>
<p> </p>
<p> </p>
<p><a name="Disconnect"></a><big><strong><font face="Arial">CPop3Connection::Disconnect</font></strong></big></p>
<p><strong><font face="Arial">BOOL CPop3Connection::Disconnect();</font></strong></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">None.</font></p>
<p><font face="Arial"><strong>Remarks</strong></font></p>
<p><font face="Arial">The corollary function of Connect.</font></p>
<p><strong><font face="Arial">See Also</font></strong></p>
<p><a href="#Connect"><font face="Arial">CPop3Connection::Connect</font></a></p>
<p> </p>
<p> </p>
<p><a name="Statistics"></a><big><strong><font face="Arial">CPop3Connection::Statistics</font></strong></big></p>
<p><font face="Arial"><strong>BOOL CPop3Connection::Statistics(int& </strong><em>nNumberOfMails</em><strong>,
int& </strong><em>nTotalMailSize</em><strong>);</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>nNumberOfMails</em> Upon a successful return this will contain
the number of mails waiting in the mailbox.</font></p>
<p><font face="Arial"><em>nTotalMailSize</em> Upon a successful return this will contain
the size in bytes (aka Octets) of all mails waiting in the mailbox.</font></p>
<p><font face="Arial"><strong>Remarks</strong></font></p>
<p><font face="Arial">Retrieves the statistics for the Mailbox by issuing the
"STAT" command.</font></p>
<p><strong><font face="Arial">See Also </font></strong></p>
<p><a href="#GetMessageSize"><font face="Arial">CPop3Connection::GetMessageSize</font></a></p>
<p> </p>
<p> </p>
<p><a name="Delete"></a><big><strong><font face="Arial">CPop3Connection::Delete</font></strong></big></p>
<p><font face="Arial"><strong>BOOL CPop3Connection::Delete(int </strong><em>nMsg</em><strong>);</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>nMsg</em> The message number of the message to delete. This
value starts at 1.</font></p>
<p><font face="Arial"><strong>Remarks</strong></font></p>
<p><font face="Arial">Marks a message as "to be deleted" by issuing the
"DELE" command.</font></p>
<p><strong><font face="Arial">See Also </font></strong></p>
<p><a href="#Reset"><font face="Arial">CPop3Connection::Reset</font></a></p>
<p> </p>
<p> </p>
<p><a name="GetMessageSize"></a><big><strong><font face="Arial">CPop3Connection::GetMessageSize</font></strong></big></p>
<p><font face="Arial"><strong>BOOL CPop3Connection::GetMessageSize(int </strong><em>nMsg</em><strong>,
DWORD& </strong><em>dwSize</em><strong>);</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>nMsg</em> The message number of the message to retrieve the size
of.</font></p>
<p><font face="Arial"><em>dwSize</em> Upon a successful return this will contain the size
in bytes of the specified message.</font></p>
<p><font face="Arial"><strong>Remarks</strong></font></p>
<p><font face="Arial">Retrieves the size of a specified message. Internally this will
issue the "LIST" command if required.</font></p>
<p><strong><font face="Arial">See Also </font></strong></p>
<p><a href="#Retrieve"><font face="Arial">CPop3Connection::Retrieve</font></a></p>
<p> </p>
<p> </p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -