Search The ForumSearch   RegisterRegister  LoginLogin

MailBee IMAP4

 AfterLogic Forum : MailBee IMAP4
Subject Topic: New mail Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
niklas
Newbie
Newbie


Joined: 08 November 2008
Location: Sweden
Online Status: Offline
Posts: 15
Posted: 29 May 2009 at 2:43am | IP Logged Quote niklas

Hi,

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 View niklas's Profile Search for other posts by niklas
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 5855
Posted: 29 May 2009 at 3:17am | IP Logged Quote Igor

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.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide