| Author |  | 
      
        | AengusO Newbie
 
  
  
 Joined: 26 February 2010
 Location: Ireland
 Online Status: Offline
 Posts: 22
 | 
          Hi, I am a user of MailBee.Net Objects - I am using MailBee ImapMail to download mails in a c# Windows service. The version of  my MailBee.Net dll is 6.8.2.827.
           | Posted: 26 January 2012 at 6:39am | IP Logged |   |  
           | 
 |  
 On one server, I keep getting an error like this:
 
 MailBee.ImapMail.MailBeeImapInvalidEnvelopeException: The envelope data is corrupted or incorrect. Envelope.IsValid will be false. The invalid envelope message number is: 2.
 at a.c.f.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 a.c.f.a(String A_0, Boolean A_1, Int32 A_2, Boolean A_3)
 at a.c.t.a(String A_0, Boolean A_1, Int32 A_2)
 at a.c.t.a(Boolean A_0, String A_1, Boolean A_2, Int32 A_3)
 at MailBee.ImapMail.Imap.DownloadEntireMessages(String messageIndexSet, Boolean indexIsUid)
 
 
 Sample code from my c# project:
 
 /// <summary>
 /// Download mail collection
 /// </summary>
 /// <returns></returns>
 protected override MailMessageCollection DownloadEntireMessages1()
 {
 if (GetNextMails() > 0)
 {
 return imap.DownloadEntireMessages(m_CurrentUids.ToString(), true);
 }
 else
 {
 return null;
 }
 }
 
 /// <summary>
 /// Check for next mails in box
 /// </summary>
 /// <returns></returns>
 private int GetNextMails()
 {
 return GetNextMails(m_FirstInRange, m_FirstInRange + m_BatchSize - 1);
 }
 
 /// <summary>
 /// Check for next mails in box
 /// </summary>
 /// <param name="FirstSeq"></param>
 /// <param name="LastSeq"></param>
 /// <returns></returns>
 private int GetNextMails(long FirstSeq, long LastSeq)
 {
 int iRetry = 3;
 while (true)
 {
 try
 {
 if (CheckLoggedIn())
 {
 string SeqSearch = FirstSeq.ToString() + ":" + LastSeq.ToString();
 m_CurrentUids = (UidCollection)imap.Search(true, SeqSearch, null);
 return m_CurrentUids.Count;
 }
 }
 catch (Exception ex)
 {
 if (--iRetry < 0)
 {
 LogHelper.Exception(ex, "Error getting next Mail");
 throw;
 }
 }
 }
 }
 
 
 
 What does this error occur and how can I get around it ?
 Regards,
 Aengus O'Sullivan
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          This usually means the server returns data which cannot be parsed. Some IMAP servers may have flaws in their IMAP implementation. Many servers are tested only against a few popular clients like Outlook and do not correctly support any IMAP commands of syntax Outlook or Thunderbird does not use.
           | Posted: 26 January 2012 at 11:32am | IP Logged |   |  
           | 
 |  
 Sometimes, MailBee is able to recover from IMAP syntax violation, you'd check with the latest version.
 
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | AengusO Newbie
 
  
  
 Joined: 26 February 2010
 Location: Ireland
 Online Status: Offline
 Posts: 22
 | 
          Thanks for the reply. Have received latest version of MailBee.Net objects, I am waiting for fix to be applied to live server and tested - will update when I get feedback,
           | Posted: 02 February 2012 at 4:49am | IP Logged |   |  
           | 
 |  
 Thanks,
 Aengus
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | AengusO Newbie
 
  
  
 Joined: 26 February 2010
 Location: Ireland
 Online Status: Offline
 Posts: 22
 | 
          Have updated server with the latest version of MailBee.NET.dll, still getting same result. What can I do next ? Is there logging I can enable to check whats happening, is there a workaround for this issue ?
           | Posted: 03 February 2012 at 1:37am | IP Logged |   |  
           | 
 |  
 Thanks,
 Aengus O'Sullivan
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Igor AfterLogic Support
 
  
 
 Joined: 24 June 2008
 Location: United States
 Online Status: Offline
 Posts: 6168
 | 
          Checking the logs might help indeed. You can enable logging using this property of IMAP object.
           | Posted: 03 February 2012 at 1:41am | IP Logged |   |  
           | 
 |  
 --
 Regards,
 Igor, AfterLogic Support
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | AengusO Newbie
 
  
  
 Joined: 26 February 2010
 Location: Ireland
 Online Status: Offline
 Posts: 22
 | 
          I upgraded to latest version of MailBee.Net and also changed logic to use DownloadEnvelopes instead of download entire messages - this fixed the issue
           | Posted: 05 March 2012 at 7:20am | IP Logged |   |  
           | 
 |  | 
       
        | Back to Top |     | 
       
       
        |  |