Secure connection
The pop3
class is used for the plain TCP connections, while pop3s
must be used
for the TLS. It inherits pop3
API but uses TLS. The authentication methods are: login and start tls. For the
login method, the well known port is 995:
try
{
pop3s conn("pop3.server.com", 995);
conn.authenticate("mailio@server.com", "mailiopass", pop3s::auth_method_t::LOGIN);
message msg;
conn.fetch(1, msg);
}
catch (pop3_error& exc)
{
cout << exc.what() << endl;
}
catch (dialog_error& exc)
{
cout << exc.what() << endl;
}
For the start tls method, the well know port is 110 as for the plain POP3 connection:
try
{
pop3s conn("pop3.server.com", 110);
conn.authenticate("mailio@server.com", "mailiopass", pop3s::auth_method_t::START_TLS);
message msg;
conn.fetch(1, msg);
}
catch (pop3_error& exc)
{
cout << exc.what() << endl;
}
catch (dialog_error& exc)
{
cout << exc.what() << endl;
}