| Author |  | 
      
        | shoey1 Newbie
 
  
  
 Joined: 19 March 2014
 Location: United Kingdom
 Online Status: Offline
 Posts: 5
 | 
          If you use an .Net SMTP client you can use the following code to get the SMTP error code and the message if there was an exception with sending a message.
           | Posted: 19 March 2014 at 8:32am | IP Logged |   |  
           | 
 |  
 try
 {
 aSmtpClient.Send(aMailMessage);
 }
 catch (SmtpException e)
 {
 ErrorCode = ((int) e.StatusCode).ToString(), //eg 553
 ErrorDescription = e.Message, //Mailbox name not allowed. The server response was: Message rejected - see http://www.spamhaus.org/query/bl?ip=46.65.200.122
 }
 
 Is there something similar to this or would i have to test for each exception type as in here: http://www.afterlogic.com/mailbee-net/docs/handle_exceptions_and_errors.html#ErrorCodes
 
 
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          Catch MailBeeSmtpNegativeResponseException for that. Its .ResponseCode and .ResponseString contain the values you need.
           | Posted: 19 March 2014 at 9:05am | IP Logged |   |  
           | 
 |  
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | shoey1 Newbie
 
  
  
 Joined: 19 March 2014
 Location: United Kingdom
 Online Status: Offline
 Posts: 5
 | 
          Thanks Alex
           | Posted: 19 March 2014 at 9:09am | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |     | 
       
       
        |  |