Hunny Software Library Reference

Pop3Client Class

Class that represents a POP3 client connection.

For a list of all members of this type, see Pop3Client Members.

System.Object
   Pop3Client

[Visual Basic]
Public Class Pop3Client
Implements IDisposable
[C#]
public class Pop3Client : IDisposable

Remarks

Pop3Client is a class that manages the client side of a POP3 connection. Specifically, Pop3Client provides facilities for opening a connection to a POP3 server, sending commands to the server, receiving responses from the server, and closing the connection. Pop3Client implements the Post Office Protocol version 3, as specified in RFC 1939, and POP3 extensions, as specified in RFC 1734 (POP3 AUTH command), RFC 2449 (POP3 CAPA command).

To use Pop3Client, first you call the Connect method to open a connection to the POP3 server. Once you have opened the connection, you call other methods to send POP3 commands to the server. After you send a command, you check the ReplyCode property to learn if the command succeeded or failed. For some commands, the server returns information as a single line response, which you may examine by getting the ReplyText property. For other commands, such as for the RETR command, the server returns information as a mulitple line response. For these commands, the library passes each line of the server's response to a method you implement and pass to the method as a delegate. After you have finished sending commands, you call the Disconnect method to close the connection to the server.

When you send a POP3 client command, you must be prepared to handle errors. If a network error occurs, the library throws an instance of Hunny.Mail.Exception. Your program should be prepared to catch this exception. In addition to network errors, your code should be prepared to handle POP3 server errors. After you invoke a client command, you should check the ReplyCode property to see if the command succeeded or failed at the POP3 server. If the command succeeded, the reply code is Pop3ReplyCode.OK. If the command failed, the reply code is Pop3ReplyCode.ERR. You may also want to get the ReplyText property, which contains the text of the server's reply.

One advanced feature of Pop3Client is the ability to cancel a network operation. For example, if you are developing an interactive application with a user interface, you may allow the user to cancel a network operation that has stalled. To provide this cability, Pop3Client provides a Cancel method that you can call from your user interface thread, which is a different thread from the thread that is controlling the POP3 connection.

Requirements

Namespace: Hunny.Mail

Assembly: Hunny.Mail (in Hunny.Mail.dll)

See Also

Pop3Client Members | Hunny.Mail Namespace | RFC 1939 Post Office Protocol - Version 3 | RFC 1734 POP3 AUTHentication command | RFC 2449 POP3 Extension Mechanism