| Author |  | 
      
        | niklas Newbie
 
  
 
 Joined: 08 November 2008
 Location: Sweden
 Online Status: Offline
 Posts: 15
 | 
          Hi,
           | Posted: 29 May 2009 at 2:43am | IP Logged |   |  
           | 
 |  
 I have a script to check new and unread e-mails. This script takes a long time to load pending how many subfolders you have in your inbox.
 
 How can I make this script faster?
 
 Set Mailer = Server.CreateObject("MailBee.IMAP4")
 Mailer.LicenseKey = "blabla"
 
 If Mailer.Connect("mailserver", 143, "user", "mail") Then
 
 Set Mailboxes = Mailer.RetrieveMailboxesEx("Inbox", False, False)
 
 If Not Mailboxes Is Nothing Then
 For i = 1 to Mailboxes.Count
 
 Mailer.SelectMailbox Mailboxes(i).Name
 
 arr = Mailer.Search(False, "UNSEEN")
 
 If  len(Mailboxes(i).Name) > "1" Then
 countUnseenMessages = uBound(arr) - lBound(arr) + 1
 sum = sum + countUnseenMessages
 End  If
 
 Next
 
 End If
 Else
 
 End If
 
 Mailer.Disconnect
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Igor AfterLogic Support
 
  
 
 Joined: 24 June 2008
 Location: United States
 Online Status: Offline
 Posts: 6168
 | 
          Well, your code itself looks fine, we don't see any way to improve it. Most probably, delays are caused by IMAP server you use, in return to either SelectMailbox or Search method calls. You can enable logging in order to check server response time.
           | Posted: 29 May 2009 at 3:17am | IP Logged |   |  
           | 
 |  
 --
 Regards,
 Igor, AfterLogic Support
 | 
       
        | Back to Top |     | 
       
       
        |  |