Entourage 2004, rebuild database, receive all new e-mails twice

  • Thread starter Ray Flinkerbusch
  • Start date
R

Ray Flinkerbusch

Hi,

I'm using Entourage 2004 and sometimes a database rebuild is necessary. My
mailbox is around 800Mb which should not pose a problem for Entourage
however I do notice that it's getting slower.

The problem I have is that when Entourage has rebuilt the database that
somewhere along the line it forgets which e-mail was already collected from
the servers (I have 5 mailaccounts because I'm working as a freelancer for
various companies). I leave my mail on those servers. Whenever the database
rebuilding is done Entourage goes out and gets all the emails which are left
on the servers (emails Entourage already has in the database). This adds up
to around 1700 emails I keep for archiving.

So I have to sort out the emails again. Does anyone have an idea why this
happens and maybe have a possible solution ?

Ray

ps. I know that a database rebuild means that Entourage has to fetch mails
from Hotmail again. Maybe the lists of "what is new mail" are related.
 
B

Barry Wainwright

Hi,

I'm using Entourage 2004 and sometimes a database rebuild is necessary. My
mailbox is around 800Mb which should not pose a problem for Entourage
however I do notice that it's getting slower.

The problem I have is that when Entourage has rebuilt the database that
somewhere along the line it forgets which e-mail was already collected from
the servers (I have 5 mailaccounts because I'm working as a freelancer for
various companies). I leave my mail on those servers. Whenever the database
rebuilding is done Entourage goes out and gets all the emails which are left
on the servers (emails Entourage already has in the database). This adds up
to around 1700 emails I keep for archiving.

So I have to sort out the emails again. Does anyone have an idea why this
happens and maybe have a possible solution ?

Ray

ps. I know that a database rebuild means that Entourage has to fetch mails
from Hotmail again. Maybe the lists of "what is new mail" are related.

This effect is a result of an advanced rebuild. Entourage rebuilds message
indexes from scratch and so loses all knowledge of which messages on the
server have been previously downloaded.

Here is a script that will delete all the duplicates in a particular folder:

tell application "Microsoft Entourage"
set theMessages to current messages
if theMessages = {} then
set theFolder to selection
if class of theFolder is folder then
set mb to theFolder
else
display dialog "In the folder listing, please select the folder
you want to be scanned for duplicates" with icon stop buttons {"Quit"}
default button 1
return -99

end if
else
set mb to storage of item 1 of theMessages
end if
set theName to name of mb
say "Removing duplicates from mail folder: " & theName
set y to count messages of mb
say "Number of messages to check, " & y
set IDlist to {}
repeat with x from y to 1 by -1
try
set theHeaders to (get headers of message x of mb)
set AppleScript's text item delimiters to {"Message-"}
set temp to text item 2 of theHeaders
set AppleScript's text item delimiters to {return}
set theId to text 5 through -1 of text item 1 of temp
on error
set theId to ""
end try
if theId is in my IDlist then
delete message x of mb
else if theId ‚ "" then
copy theId to end of IDlist
end if
if x mod 100 = 0 then say "" & x
end repeat
set removedCount to y - (count messages of mb)
if removedCount is 0 then
say "Finished. No duplicates detected"
else
say "Finished. " & removedCount & " duplicates removed"
end if
set AppleScript's text item delimiters to {""}
end tell
 
R

Ray Flinkerbusch

Hi Barry,

Thanks for your quick response. One question though:

I have a large folderstructure under the inbox. Would it be possible to let
the script start at the top in the inbox and automagically work its way down
through all the folders and subfolders?

Ray
 
B

Barry Wainwright

It certainly would - that was the way the script was originally written!

Try this:

-- this is the line that kicks it all off and starts the recursion
-- see how it works in the 'removeDuplicates' routine later
tell application "Microsoft Entourage"
repeat with aFolder in every folder
if ID of aFolder = 1 or ID of aFolder > 6 then -- skip top level
folders except inbox
my removeDuplicates(aFolder)
end if
end repeat
end tell

on removeDuplicates(mb)
tell application "Microsoft Entourage"
set theName to name of mb
say "Removing duplicates from mail folder: " & theName
set y to count messages of mb
say "Number of messages to check, " & y
set IDlist to {}
repeat with x from y to 1 by -1
try
set theHeaders to (get headers of message x of mb)
set AppleScript's text item delimiters to {"Message-"}
set temp to text item 2 of theHeaders
set AppleScript's text item delimiters to {return}
set theId to text 5 through -1 of text item 1 of temp
on error
set theId to ""
end try
if theId is in my IDlist then
delete message x of mb
else if theId ‚ "" then
copy theId to end of IDlist
end if
if x mod 100 = 0 then say "" & x
end repeat
set removedCount to y - (count messages of mb)
if removedCount is 0 then
say "Finished with mailbox " & theName & ". No duplicates
detected"
else
say "Finished with mailbox " & theName & ". " & removedCount & "
duplicates removed"
end if
repeat with subFolder in every folder of mb
my removeDuplicates(subFolder)
end repeat
end tell
end removeDuplicates
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top