CPop3Socket - Connect to a POP3 server using CSocket..
CPop3Socket implements a MFC class to receive messages from a POP3 server. The common commands are implemented.
Note that most email messages received from the POP3 server are probably MIME encoded. You can use CMimeDecode class to decode these messages.


BOOL Connect(LPCTSTR lpszServer, LPCTSTR lpszUserName, LPCTSTR lpszPass, UINT nPort);
Connect to a POP3 server.

lpszServer - POP3 server name.
lpszUserName - Name of the user to log in.
lpszPass - Password to use to log in.
nPort - A number that identifies the TCP/IP port to use on the server (default: 110).

void Disconnect();
Disconnect from POP3 server

BOOL Statistics(int &nMessageCount, int &nTotalMessageSize);
Get the number of messages on the server and total size of mailbox.

nMessageCount - message count
nTotalMessageSize - total size of all messages

BOOL Noop();
Send the NOOP command to the server.

BOOL List(CDWordArray &dwSizeArray, int nMessage = -1);
Lists message number and size of each message.
If a message number is specified, returns the size of the specified message.

dwSizeArray - array that will receive the message sizes.
nMessage - number of the message to receive the size from (-1 = all messages)

BOOL Top(CString &strResponse, int nMessage, int nLineCount = 0);
Get the message header and a specified number of lines of the message.

strResponse - this variable will receive the response of the TOP command.
nMessage - number of the message to receive the TOP from.
nLineCount - number of lines to get from the message.

BOOL Retrieve(CString &strResponse, int nMessage);
Retrieve the specified message and put the result in strResponse.

BOOL Delete(int nMessage);
Mark a message for deletion.

BOOL Reset();
Unmark all messages that are marked for deletion.

BOOL GetMessageHeader(int nMessage, CPop3Message &message);
Get the header of the specified message and put it in the CPop3Message object.

BOOL GetMessage(int nMessage, CPop3Message &message);
Retrieve the specified message and put it in the CPop3Message object.

Download demo executable

Download source code
This class is part of the Pablo Software Solutions MFC Extension Package - Classes Edition

Also available:


[Home] [Products] [Source Code] [Downloads]

© 2015 - Pablo Software Solutions
All rights reserved.