title: Reading Emails from Gmail C# - IMAP
body: <p>I'm trying to read emails from specific Gmail account. I have found something here(Stackoverflow) but I can't manage reading the emails.</p>
  
  <p>this is what I'm using:</p>
  
  <pre><code> public static void logingmail()
      {
          // Connect to the IMAP server. The 'true' parameter specifies to use SSL
          // which is important (for Gmail at least)
          ImapClient ic = new ImapClient("imap.gmail.com", "Any@gmail.com", "4521945219",AuthMethods.Login, 993, true);
          // Select a mailbox. Case-insensitive
          ic.SelectMailbox("Inbox");
         string countmessages = ic.GetMessageCount().ToString();
          // Get the first *11* messages. 0 is the first message;
          // and it also includes the 10th message, which is really the eleventh ;)
          // MailMessage represents, well, a message in your mailbox
          MailMessage[] mm = ic.GetMessages(0, 10);
          foreach (MailMessage m in mm)
          {
  
              var subject = m.Subject.ToString();
          }
          // Probably wiser to use a using statement
          ic.Dispose();
  
      }
  </code></pre>
  
  <p>The problem I'm experiencsing probably happening when I'm first creating the new ImapCliient class. for some reason it's opening a browse path to choose a file(?).
  I'll be happy for some assistance.
  Thanks</p>