| Author |  | 
      
        | Maritim Newbie
 
  
 
 Joined: 06 December 2012
 Location: Norway
 Online Status: Offline
 Posts: 1
 | 
          I am using MailBee.NET 4 for sending e-mail via SMTP, but I am experiencing some strange behaviour. I am writing some sophisticated error handling and therefore I have need of the SMTP reply code from the server after an attempt at sending e-mail has been made. However, when I attempt to call the MailBee.SmtpMail.Smtp.GetServerResponseCode() (http://www.afterlogic.com/mailbee-net/docs/MailBee.SmtpMail.Smtp.GetServerResponseCode.html) I receive a MailBeeInvalidStateException since I am apparently no longer in an SMTP context.
           | Posted: 06 December 2012 at 3:14am | IP Logged |   |  
           | 
 |  
 Could someone please enlighten me with regard to the reason for why I am no longer in an SMTP context? This makes no sense to me.
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          There is a number of conditions to be met to stay in SMTP context. Mail of them:
           | Posted: 08 December 2012 at 11:46am | IP Logged |   |  
           | 
 |  - the connection must be made to a single SMTP relay server. Multi-threaded connections and direct send operations are not SMTP contexts (they are more complex contexts)
 - .Connect (and .Hello, .Login) method must be called explicitly. Otherwise, to the moment when .Send method ends, it disconnects automatically. If .Connect was called manually, .Send keeps SMTP connection (and context).
 
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  |