Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
UppHub
Status & Roadmap
FAQ
Authors & License
Forums
Funding U++
Search on this site











SourceForge.net Logo

SourceForge.net Logo

GitHub Logo

Discord Logo

Pop3

 

class Pop3 : public TcpSocket

Encapsulates the Post Office Protocol, Version 3 (POP3) as specified in the RFC 1939. This class provides a simplified interface to a single POP3 mailbox.

Important: Pop3 indicies are 1 based! Thus the correct loop to obtain all messages is for(int i = 1; i <= pop3.GetMessageCount(); i++).

 

Requires OpenSSL library.

 

Public Method List

 

Pop3& Host(const String& h)

Sets hostname. Returns *this for method chaining.

 


 

Pop3& Port(int p)

Sets port number. Returns *this for method chaining.

 


 

Pop3& User(const String& u, const String& p)

Sets username and password. Returns *this for method chaining.

 


 

Pop3& SSL(bool b = true)

Activates POP3S mode (using SSL). Requires Core/SSL package. Returns *this for method chaining.

 


 

Pop3& Proxy(const String& host, int port)

Sets HTTP CONNECT proxy for connection.

 


 

Pop3& Proxy(const char *p)

Sets HTTP CONNECT proxy for connection, parameter contains host and port separated by ':'.

 


 

Pop3& ProxyAuth(const String& u, const String& p)

Sets the username and password for proxy..

 


 

int GetMessageCount()

Returns the number of currently available messages in the POP3 mailbox. Returns -1 on failure.

 


 

String GetMessage(int index)

Retreives a message with the given index from the POP3 mailbox. Returns Null on failure. First message has index 1, last GetMessageCount().

 


 

String GetMessageHeader(int index)

Retreives the header section of a message with the given index from the POP3 mailbox. Returns Null on failure. First message has index 1, last GetMessageCount().

 


 

bool GetMessageList(ValueMap& list)

Retrieves the list of currently available messages in the POP3 mailbox. list is a ValueMap containing messages indices and sizes as integer key and integer value pairs. Returns true on success.

 


 

String GetMessageUniqueId(int index)

Retreives the unique identifier string of a message with the given index from the POP3 mailbox. Returns Null on failure.

 


 

bool GetMessageUniqueIds(ValueMap& uids)

Retrieves the unique identifier strings of currently available messages in the POP3 mailbox. uids is a ValueMap containing messages indices and unique identifiers as integer key and String value pairs. Returns true on success.

 


 

bool RemoveMessage(int index)

Marks a message with the given index to be deleted from the POP3 mailbox. Messages marked for deletion are only deleted by the POP3 server after a successful Logout(). If you want to unmark messages, you must invoke Undo() method before logging out. Returns true on success.

 


 

bool Undo()

Resets POP3 session. Useful for unmarking the messages marked to be deleted. This method must be invoked before any Logout(). Returns true on success.

 


 

bool Noop()

Sends a NOOP command to the POP3 server. Useful for keeping connections alive.

 


 

bool Login()

Connect and login to the POP3 server. User name and password must be set. Uses APOP authentication mechanism, if available. Returns true on success.

 


 

bool Logout()

Logout of and disconnect from the POP3 server. Messages marked for deletion will be permanently deleted from the server after a successful logout. Returns true on success. Calling Logout on mailbox that is not online does nothing.

 


 

bool IsOnline() const

Returns true if the POP3 mailbox is online.

 


 

String GetLastError()

Returns the description of last error.

 


 

static void Trace(bool b = true)

Activates logging of POP3.

 


 

Pop3()

Default constructor.

 


 

~Pop3()

Destructor calls Logout.

 

 

Do you want to contribute?