0 votes
by (430 points)
edited

Hello all, is there a way to access the response to the CAPA command when the Rebex POP3 class connects to a POP3 server ? I am especially interested in the LOGIN-DELAY value. the only way I found is defining a Logwriter class and parse the response.

thanks and best regards.

Applies to: Rebex Secure Mail

1 Answer

0 votes
by (72.7k points)
edited

You can send commands and read responses on your own. The following sample code solves your needs:

Pop3 client = new Pop3();
client.Connect("pop.gmail.com", 995, null, Pop3Security.Implicit);

int delay = -1;
client.SendCommand("CAPA", true);
for (string response = client.ReadResponse(); response != null; response = client.ReadResponse())
{
    if (response.StartsWith("LOGIN-DELAY", StringComparison.OrdinalIgnoreCase))
        delay = int.Parse(response.Substring(12).Trim());
}
Console.WriteLine(delay);
by (430 points)
edited

thanks, Lukas. however, this would involve sending the CAPA command twice, once within the Connect method, then with SendCommand. not very bad, but not nice either.

...