ComponentPro UltimateBounceInspector

      Handling exceptions

      Language Filter: AllSend comments on this topic to ComponentPro

      Exceptions thrown by the component and its dependencies can be easily caught by using try catch block. The table below lists all exceptions that can be caught when using the component: 

      Exception Description
      UltimateLicenseException The exception that is thrown when an error occurs while checking the license.
      ImapException The exception that is thrown when an IMAP error occurs.
      Pop3Exception The exception that is thrown when a POP3 error occurs.
      ProxySocketException The exception that is thrown when a proxy error or socket error occurs.
      BounceInspectorException The exception that is thrown when a Bounce Inspector error occurs.


      The example below shows how to handle exceptions:

      using System;
      using ComponentPro.Net.Mail;
          // Main Code 
          // Create a new instance of the BounceInspector class. 
          BounceInspector inspector = new BounceInspector();
          // Create a new MailMessage object. 
          MailMessage msg = new MailMessage();
          // Create a new message object. 
          msg.BodyText = "Last-Attempt-Date: Sat, 13 Nov 2004 00:08:17 -0800\r\n;Diagnostic-Code: smtp; 550 RCPT TO:<> User unknown\r\nRemote-MTA: dns;\r\nStatus: 5.1.1 (bad destination mailbox address)\r\nOriginal-Recipient:\r\nOriginal-Recipient: rfc822;\r\nFinal-Recipient: rfc822;\r\nAction: delayed\r\nStatus: 4.4.7\r\nWill-Retry-Until: Sat, 13 Nov 2004 00:08:17 -0800";
          msg.Subject = "It's a test message";
          // And process the message. 
          BounceResult r = inspector.Process(msg);
          // If this message was identified as a bounced email message.                 
          if (r.Identified)
              Console.WriteLine("Bounced E-mail: " + r.Addresses[0]);
          // End Main Code
      catch (BounceInspectorException be)
          Console.WriteLine(string.Format("A BounceInspector error occurred: {0}. Status: {1}.", be.Message, be.Status));
      catch (Exception exc)
          Console.WriteLine(string.Format("An error occurred: {0}", exc.Message));