POP3 connect and CAPA

0 votes
asked Sep 21, 2011 by Fritz (430 points)
edited Sep 22, 2011

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
answered Sep 21, 2011 by Lukas Matyska (60,770 points)
edited Sep 22, 2011

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);
commented Sep 22, 2011 by Fritz (430 points)
edited Sep 22, 2011

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.

...