CPJNPOP3Connection LogoCPJNPOP3Connection v1.70

Welcome to CPJNPOP3Connection, a freeware C++ class framework to support the POP3 (Post Office Protocol v3) protocol. POP3 for those not familiar with all the internet protocols is the protocol used to retrieve internet email.

References
Features
Usage
Copyright
History
API Reference
Contacting the Author

 

 

 

References

 

 

 

Features

 

 

 

Usage

 

 

 

Copyright

 

 

 

History

v1.70 (27 May 2023)

v1.69 (4 December 2022)

v1.68 (18 April 2022)

v1.67 (8 January 2022)

v1.66 (23 April 2021)

v1.65 (4 May 2020)

v1.64 (7 January 2020)

v1.63 (27 December 2019)

v1.62 (2 October 2019)

v1.61 (21 April 2019)

v1.60 (4 November 2018)

v1.59 (25 June 2018)

v1.58 (18 December 2017)

v1.57 (12 September 2017)

v1.56 (29 April 2017)

v1.55 (26 March 2017)

v1.54 (19 August 2016)

v1.53 (27 July 2016)

v1.52 (12 June 2016)

v1.51 (23 December 2014)

v1.50 (13 April 2014)

v1.49 (9 February 2014)

v1.48 (13 February 2011)

v1.47 (22 December 2009)

v1.46 (4 May 2009)

v1.45 (14 June 2008)

v1.44 (31 May 2008)

v1.43 (18 May 2008)

v1.42 (18 March 2008)

v1.41 (31 December 2007)

v1.40 (21 July 2007)

v1.39 (20 November 2006)

v1.38 (9 July 2006)

v1.37 (13 February 2006)

v1.36 (8 February 2006)

v1.35 (9 April 2005)

v1.34 (28 March 2005)

v1.33 (9 August 2004)

v1.32 (4 July 2004)

v1.31 (5 June 2004)

v1.30 (12 November 2003)

v1.29 (6 November 2003)

v1.28 (3 November 2003)

v1.27 (21 July 2003)

v1.26 (5 July 2003)

29 March 2003

v1.25 (29 September 2001)

v1.24 (27 September 2001)

v1.23 (11 August 2001)

v1.22 (27 July 2001)

24 March 2001

v1.21 (20 September 2000)

v1.20 (26 March 2000)

v1.19 (24 August 1999)

v1.18 (5 July 1999)

v1.17 (29 June 1999)

v1.16 (27 June 1999)

v1.15 (16 June 1999)

v1.14 (15 June 1999)

v1.13 (25 March 1999)

v1.12 (22 February 1999)

v1.11 (4 January 1999)

v1.1 (28 June 1998)

v1.0 (18 May 1998)

 

 

 

API Reference

The API consists of the public member functions of the class CPJNPOP3Connection

Connect
Disconnect
Statistics
Delete
GetMessageSize
GetMessageID
Retrieve
Reset
UIDL
GetMessageHeader
Noop
GetLastCommandResponse
GetTimeout
SetTimeout
GetReadBufferSize
SetReadBufferSize

 

CPJNPOP3Connection::Connect

void CPJNPOP3Connection::Connect(LPCTSTR pszHostName, LPCTSTR pszUser,   LPCTSTR pszPassword, int nPort = 110, AuthenticationMethod am = AUTH_PLAIN, BOOL bSSL = FALSE);

Parameters

pszHostName 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”.

pszUser This is the POP3 user name of the mailbox.

pszPassword This is the password for the POP3 mailbox.

nPort This is the port number on which to connect. The default value is 110 which is the default POP3 port number.

am The authentication method to use. Choices are AUTH_PLAIN which corresponds to using the "USER / PASS" commands or AUTH_APOP which uses the APOP challenge / response command.

bSSL If compiled to support SSL, then setting this value will cause the connection to be made over a SSL connection instead of in the clear.

Remarks

Call this member function to establish a connection to a POP3 mailbox.

See Also

CPJNPOP3Connection::Disconnect

 

CPJNPOP3Connection::Disconnect

void CPJNPOP3Connection::Disconnect(BOOL bGracefully = TRUE);

Parameters

bGracefully TRUE if the "QUIT" command should be issued to the POP3 server before closing the connection.

Remarks

The corollary function of Connect.

See Also

CPJNPOP3Connection::Connect

 

CPJNPOP3Connection::Statistics

void CPJNPOP3Connection::Statistics(int& nNumberOfMails, int& nTotalMailSize);

Parameters

nNumberOfMails Upon a successful return this will contain the number of mails waiting in the mailbox.

nTotalMailSize Upon a successful return this will contain the size in bytes (aka Octets) of all mails waiting in the mailbox.

Remarks

Retrieves the statistics for the Mailbox by issuing the "STAT" command.

See Also

CPJNPOP3Connection::GetMessageSize

 

CPJNPOP3Connection::Delete

void CPJNPOP3Connection::Delete(int nMsg);

Parameters

nMsg The message number of the message to delete. This value starts at 1.

Remarks

Marks a message as "to be deleted" by issuing the "DELE" command.

See Also

CPJNPOP3Connection::Reset

 

CPJNPOP3Connection::GetMessageSize

DWORD CPJNPOP3Connection::GetMessageSize(int nMsg);

Return Value

Upon a successful return this will contain the size in bytes of the specified message.

Parameters

nMsg The message number of the message to retrieve the size of.

Remarks

Retrieves the size of a specified message. Internally this will issue the "LIST" command if required.

See Also

CPJNPOP3Connection::Retrieve

 

CPJNPOP3Connection::GetMessageID

CPJNPOP3String CPJNPOP3Connection::GetMessageID(int nMsg);

Return Value

Upon a successful return this will contain the ID of the specified message as a string.

Parameters

nMsg The message number of the message to retrieve the ID of.

Remarks

Retrieves the ID of a specified message. Internally this will issue the "UIDL" command if required. As "UIDL" is an optional POP3 command, your client app should handle the return value if it is to correctly work on all POP3 servers.

See Also

CPJNPOP3Connection::UIDL

 

CPJNPOP3Connection::Retrieve

void CPJNPOP3Connection::Retrieve(int nMsg, CPJNPOP3Buffer& message);

Parameters

nMsg The message number of the message to retrieve the size of.

message Upon a successful return this will contain the POP3 messages. This class is a simple derivation of the MFC CByteArray class

Remarks

Retrieves the specified message by issuing the "RETR" command.

See Also

CPJNPOP3Connection::GetMessageSize

 

CPJNPOP3Connection::GetMessageHeader

void CPJNPOP3Connection::GetMessageHeader(int nMsg, CPJNPOP3Buffer& message);

Parameters

nMsg The message number of the message to retrieve the header of.

message Upon a successful return this will contain the POP3 message header.

Remarks

Retrieves the header of a specified message. Internally this will issue the "TOP" command if required. As "TOP" is an optional POP3 command, your client app should handle the return value if it is to correctly work on all POP3 servers.

See Also

CPJNPOP3Connection::GetMessage

 

CPJNPOP3Connection::Reset

void CPJNPOP3Connection::Reset();

Parameters

None.

Remarks

Resets all messages which were previously marked as deleted. i.e. it undoes the work of all the DELE commands in this session. For further information about how messages are deleted in POP3, please refer to the RFC.

See Also

CPJNPOP3Connection::Delete

 

CPJNPOP3Connection::UIDL

void CPJNPOP3Connection::UIDL();

Parameters

None.

Remarks

Sends the "UIDL" command which retrieves the ID for a specified message. As "UIDL" is an optional POP3 command, your client app should handle the return value if it is to correctly work on all POP3 servers.

See Also

CPJNPOP3Connection::GetMessageID

 

CPJNPOP3Connection::Noop

void CPJNPOP3Connection::Noop();

Parameters

None.

Remarks

Issues a "NOOP" command to the server.

 

CPJNPOP3Connection::GetLastCommandResponse

CPJNPOP3String CPJNPOP3Connection::GetLastCommandResponse() const;

Return Value

The last command response from the server as a string.

Parameters

None.

Remarks

The CPJNPOP3Connection class can return additional text information along with most errors. This extended error information can be retrieved by using the GetLastCommandResponse function after an unsuccessful function call. An example of this is if the Connect function failed because of a validation problem, GetLastCommandResponse could return something like "-ERR Access is denied". GetLastCommandResponse can be called multiple times until another CPJNPOP3Connection function is called which sends a POP3 command.

 

CPJNPOP3Connection::GetTimeout

DWORD CPJNPOP3Connection::GetTimeout() const;

Return Value

The timeout in milliseconds which the code will wait for responses from the POP3 server.

Parameters

None.

Remarks

Since CPJNPOP3Connection provides a synchronous API, a timeout mechanism is provided. By default the value is 2 seconds in release mode and 20 seconds in debug mode. The value is larger in debug mode so that the code does not time out when you are debugging it.

See Also

CPJNPOP3Connection::SetTimeout

 

CPJNPOP3Connection::SetTimeout

void CPJNPOP3Connection::SetTimeout(DWORD dwTimeout)

Return Value

None.

Parameters

dwTimeout The new timeout value in milliseconds.

Remarks

Sets the timeout to use for connections to the POP3 server.

See Also

CPJNPOP3Connection::GetTimeout

 

CPJNPOP3Connection::GetReadBufferSize

DWORD CPJNPOP3Connection::GetReadBufferSize() const;

Return Value

The buffer size to use for receiving responses from the POP3 server.

Parameters

None.

Remarks

By default this value is 1024 bytes.

See Also

CPJNPOP3Connection::SetReadBufferSize

 

CPJNPOP3Connection::SetReadBufferSize

void CPJNPOP3Connection::SetReadBufferSize(DWORD dwReadBufferSize) const;

Return Value

None.

Parameters

dwReadBufferSize The buffer size to use in bytes.

Remarks

The corollary function to GetReadBufferSize.

See Also

CPJNPOP3Connection::GetReadBufferSize

 

 

 

Contacting the Author

PJ Naughter
Email: pjna@naughter.com
Web: http://www.naughter.com
27 May 2023