DataReelDataReelC++ Toolkit Documentation

POP3 Client

gxsPOP3Client reads mail over TLS only: implicit TLS on port 995 or STLS on port 110.

Contents

Overview
Functions

Overview

With gxsMAIL_STARTTLS a server that does not accept STLS is refused. Multi-line replies are read to the terminating dot and un-stuffed.

gxsPOP3Client pop3;
std::string msg;
if(pop3.Connect("mail.example.com") == 0 && pop3.Login("user", "pw") == 0 &&
   pop3.Retr(1, msg) == 0)
  std::cout << msg;
pop3.Quit();

Functions

int gxsPOP3Client::Connect(const std::string &host, int port = gxSOCKET_SPOP3_PORT, gxsMailSecurity security = gxsMAIL_IMPLICIT_TLS)

Connects and starts TLS. Returns 0 if successful.

int gxsPOP3Client::Login(const std::string &user, const std::string &passwd)

USER and PASS.

int gxsPOP3Client::Stat(int &num_messages, long long &total_bytes)

Mailbox size.

int gxsPOP3Client::List(std::string &listing)

"number size" lines.

int gxsPOP3Client::Retr(int message_number, std::string &message)

Whole message.

int gxsPOP3Client::Top(int message_number, int lines, std::string &message)

Headers and the first lines of the body.

int gxsPOP3Client::Delete(int message_number) / Reset() / Quit()

DELE, RSET and QUIT.

const std::string &gxsPOP3Client::Error() const / LastReply() const

Last failure and reply.