ComponentPro UltimateBounceInspector

      CheckForUpdates() Method

      See AlsoMembers Options: Show AllLanguage Filter: AllSend comments on this topic to ComponentPro
      Sends NOOP or IDLE command to the server and checks for IMAP server notifications.

      Syntax

      public bool CheckForUpdates()

      Return Value

      If any new notifications were received, it returns true and Update event is fired; otherwise is false.

      Remarks

      The CheckForUpdates method is useful when you want to check for any possible updates including message deleted, message flags changed, etc. from the server. See ImapUpdateEvent for a list of supported notifications.

      Typically, a client application will call CheckForUpdates periodically while idle.

      This method represents IMAP NOOP command.

      Examples

      Shows how to handle Update event and use the Noop method to check for updates from the IMAP server.

      using System;
      using ComponentPro.Net;
      using ComponentPro.Net.Mail;
      
      ...
      
      static void Main()
      {
          // IMAP server information. 
          const string serverName = "imap.gmail.com";
          const string user = "username@gmail.com";
          const string password = "password";
          const int port = 993;
          const SslSecurityMode securityMode = SslSecurityMode.Implicit;
      
          // Create a new instance of the Imap class. 
          Imap client = new Imap();
      
          // Connect to the server. 
          client.Connect(serverName, port, securityMode);
      
          // Login to the server. 
          client.Authenticate(user, password);
      
          // Select 'INBOX' mailbox 
          client.Select("INBOX");
      
          client.Update += client_Update;
      
          // ... 
       
          while (!quit)
          {
              // ... 
       
              // Wait for 10 seconds. 
              client.CheckForUpdates(10000);
      
              // ... 
          }
      
          // ... 
       
          // Close the connection. 
          client.Disconnect();
      }
      
      static void client_Update(object sender, ImapUpdateEventArgs e)
      {
          switch (e.Event)
          {
              case ImapUpdateEvent.MessageCount:
                  Console.WriteLine("New message received.");
                  // You can download the newly received message here. 
                  break;
      
              case ImapUpdateEvent.MessageRemoved:
                  Console.WriteLine("One or more messages removed.");
                  break;
          }
      }

      Framework

      .NET Compact Framework.NET Compact Framework

      Supported version: 2.0, 3.5, and 3.9
      Assembly: ComponentPro.Mail.CF (in ComponentPro.Mail.CF.dll)

      .NET Framework.NET Framework

      Supported version: 2.0, 3.0, 3.5, 4.0, 4.5.x, 4.6.x and later
      Assembly: ComponentPro.Mail (in ComponentPro.Mail.dll)

      Xamarin AndroidXamarin Android

      Supported version: 2.3 and later
      Assembly: ComponentPro.Mail.Android (in ComponentPro.Mail.Android.dll)

      Xamarin MacXamarin Mac

      Supported version: 2.0.x and later
      Assembly: ComponentPro.Mail.Mac (in ComponentPro.Mail.Mac.dll)

      Xamarin iOSXamarin iOS

      Supported version: 5.1.x and later
      Assembly: ComponentPro.Mail.iOS (in ComponentPro.Mail.iOS.dll)

      See Also