-ERR Exceeded the login limit for a 15 minute period. Reduce the frequency of requests to the POP3 server

StackOverflow https://stackoverflow.com/questions/18886359

  •  29-06-2022
  •  | 
  •  

Question

using following code i have reading msg from my hotmail account . But sometimes the following error coming . -ERR Exceeded the login limit for a 15 minute period. Reduce the frequency of requests to the POP3 server . can anyone tell me whats the reason for this ? Is that server problem or anything else ? other than pop3 anyother protocol can we use for hotmail?

  public string hotmail(string username, string password)
  {
    string result = "";
    string str = string.Empty;
    string strTemp = string.Empty;
    try
    {
        TcpClient tcpclient = new TcpClient();
        tcpclient.Connect("pop3.live.com", 995);
        System.Net.Security.SslStream sslstream = new SslStream(tcpclient.GetStream());
        sslstream.AuthenticateAsClient("pop3.live.com");
        System.IO.StreamWriter sw = new StreamWriter(sslstream);
        System.IO.StreamReader reader = new StreamReader(sslstream);
        strTemp = reader.ReadLine();
        sw.WriteLine("USER" + " " + username);
        sw.Flush();
        strTemp = reader.ReadLine();
        sw.WriteLine("PASS" + " " + password);
        sw.Flush();
        strTemp = reader.ReadLine();
        string[] numbers = Regex.Split(strTemp, @"\D+");
        int a = 0;
        foreach (string value in numbers)
        {
            if (!string.IsNullOrEmpty(value))
            {

                int i = int.Parse(value);
                numbers[a] = i.ToString();
                a++;
            }
        }
        sw.WriteLine("RETR" + " " + numbers[0]);
        sw.Flush();
        strTemp = reader.ReadLine();
        while ((strTemp = reader.ReadLine()) != null)
        {
            if (strTemp == ".")
            {
                break;
            }
            if (strTemp.IndexOf("-ERR") != -1)
            {
                break;
            }
            str += strTemp;
        }
        sw.WriteLine("Quit ");
        sw.Flush();
        result = str;
        return result;
     }
     Catch ( Exception ex)
     {}
     return result;
  }

thanks in advance ..

Was it helpful?

Solution 2

Go to the mail inbox , you may get mail regarding this and accept it. Otherwise Try to give the request after some time. Because google having some restriction to read mail using pop settings.

OTHER TIPS

Any other protocol you can use? Yes, hotmail/outlook.com now supports IMAP.

But the issue with the code here seems to be that you're creating a new TcpClient every time you run this. If you're running it many times in in a row, Outlook.com/Hotmail will eventually complain. It's as if you've got tons of clients from a single source connecting to their server, which is, when it's not testing code, often a sign of email abuse.

TcpClient tcpclient = new TcpClient();  // Hello, new.
tcpclient.Connect("pop3.live.com", 995);

If you've got a lot to do on the server, keep a single connection active longer, and close it up when you're done.

Every time you run the code in your question, you're creating (and not tcpclient.Close()-ing) a connection to pop3.live.com. I usually only get this error when I've had a lot of connections that don't close properly due to errors when I'm messing with my code.

MSDN actually has a decent example for TcpClient, but you might be more interested in another example from SO here. Check out how it uses using, and nests a loop inside.

using (TcpClient client = new TcpClient())
{
    client.Connect("pop3.live.com", 995);

    while(variableThatRepresentsRunning)
    {
        // talk to POP server
    }
}

By the way, the best advice I can give here is to tell you not to reinvent the wheel (unless you're just having fun playing with the POP server. Throwing commands via TCP can be lots of fun, especially with IMAP).

OpenPop.NET is a great library to handle POP requests in C#, includes a good MIME parser, and, if you're still working on this, should speed you along quite a bit. Its examples page is excellent.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top