| Author |  | 
      
        | fernandonp Newbie
 
  
 
 Joined: 22 June 2009
 Location: Brazil
 Online Status: Offline
 Posts: 3
 | 
          I need to know how to verify if there are a new message in my mail box.. Somebody know??
           | Posted: 22 June 2009 at 12:40pm | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Andrew AfterLogic Support
 
  
 
 Joined: 28 April 2006
 Location: United States
 Online Status: Offline
 Posts: 1189
 | 
          If you're talking about an IMAP mailbox, your application should connect to the mailbox, select necessary folder (e.g. Inbox), then search for new messages and check number of items in the resulting collection returned by the Search method. You should specify UNSEEN as search condition.
           | Posted: 22 June 2009 at 11:13pm | IP Logged |   |  
           | 
 |  
 Best regards,
 Andrew
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | fernandonp Newbie
 
  
 
 Joined: 22 June 2009
 Location: Brazil
 Online Status: Offline
 Posts: 3
 | 
          Thanks! Worked!
           | Posted: 23 June 2009 at 6:34am | IP Logged |   |  
           | 
 |  
 Imap imap = new Imap();   //New object IMAP
 imap.Connect("domain", 143); //Conect to domain
 imap.Login("login", "psw"); // Login
 imap.SelectFolder("Inbox"); // Select the folder
 MessageIndexCollection msgs = imap.Search(false, "Unseen", null); // Get the new messages
 
 if (msgs.Count>0)
 {
 //if there are new messages to do...
 }
 
 Thnks a lot!
 | 
       
        | Back to Top |     | 
       
       
        |  |