| Author |  | 
      
        | jnapier Newbie
 
  
 
 Joined: 01 March 2010
 Location: United States
 Online Status: Offline
 Posts: 2
 | 
          Hi, Im getting an error when attempting to download envelopes from a folder.
           | Posted: 01 March 2010 at 6:45pm | IP Logged |   |  
           | 
 |  
 This is the error
 The server has responded with negative reply. The server responded: MBN00000004 NO The specified message set is invalid..
 
 Stack Trace
 Help Link
 Stack Trace at c3.a(e9 A_0) at c3.ai() at bc.b(String A_0, fb A_1, Boolean A_2) at bc.a(String A_0, fb A_1, Boolean A_2) at g2.a(String A_0, Boolean A_1) at g2.a(String A_0, Boolean A_1, EnvelopeParts A_2, Int32 A_3, String[] A_4, String[] A_5, Boolean A_6, Boolean A_7) at c0.a(String A_0, Boolean A_1, EnvelopeParts A_2, Int32 A_3, String[] A_4, String[] A_5) at c0.a(Boolean A_0, String A_1, Boolean A_2, EnvelopeParts A_3, Int32 A_4, String[] A_5, String[] A_6) at MailBee.ImapMail.Imap.DownloadEnvelopes(String messageIndexSet, Boolean indexIsUid, EnvelopeParts parts, Int32 bodyPreviewSize, String[] extraHeaders, String[] extraItems) at MailBee.ImapMail.Imap.DownloadEnvelopes(String messageIndexSet, Boolean indexIsUid) at
 
 
 Code
 
 //open the bounced welcome email folder on the server
 imapServer.SelectFolder(settings.WelcomeEmailFolderName);
 
 
 //get the envelopes for all the emails in the folder
 _log.Debug("Retrieving messages from mail server.");
 EnvelopeCollection envelopes = imapServer.DownloadEnvelopes(Imap.AllMessages, false);
 
 if(envelopes.Count <= 0){
 _log.Info("No  messages found in mail folder.");
 return;
 }
 
 Any ideas on how to resolve this would be greatly appreciated.
 
 Thanks,
 Jesse
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Igor AfterLogic Support
 
  
 
 Joined: 24 June 2008
 Location: United States
 Online Status: Offline
 Posts: 6168
 | 
          I would suggest checking imapServer.MessageCount property prior to calling DownloadEnvelopes method. If there are no messages in selected folder, some mail servers might reject an attempt to download envelopes.
           | Posted: 02 March 2010 at 2:16am | IP Logged |   |  
           | 
 |  
 --
 Regards,
 Igor, AfterLogic Support
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | jnapier Newbie
 
  
 
 Joined: 01 March 2010
 Location: United States
 Online Status: Offline
 Posts: 2
 | 
          Yes, it appears that the error was occurring when there were no messages in the folder. I didnt see any examples indicating this needed to be done. Checking the count first resolves the problem.
           | Posted: 02 March 2010 at 9:54am | IP Logged |   |  
           | 
 |  
 Thanks.
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | bobmorton Newbie
 
  
  
 Joined: 28 September 2010
 Location: United States
 Online Status: Offline
 Posts: 1
 | 
          Oh I got the same error. I can't fixed it yet
           | Posted: 01 October 2010 at 8:07pm | IP Logged |   |  
           | 
 |   ... I'll try to do what you say. | 
       
        | Back to Top |     | 
       
       
        |  |