How do I automate deletion of duplicate messages?

K

Kundan Kumar

I use entourage on my laptop. During the course of the day, I switch
networks many times. I use "Leave a copy of messages on server" and then
"Delete messages from server". Sometimes all of my account emails are
downloaded again. Right now, I have four copies of most of the messages.

What can I do to get rid of the duplicate messages and keep only 1. Can it
be automatic?

Regards,
Kundan
 
D

Dave Cortright

I use entourage on my laptop. During the course of the day, I switch
networks many times. I use "Leave a copy of messages on server" and then
"Delete messages from server". Sometimes all of my account emails are
downloaded again. Right now, I have four copies of most of the messages.

If I were you, I'd seriously consider dumping your POP account and moving to
an IMAP account. That will prevent this hassle.
 
K

Kundan Kumar

If I were you, I'd seriously consider dumping your POP account and moving to
an IMAP account. That will prevent this hassle.
I moved to IMAP :). It may be simple, but I need to set the following
(could not decipher from Entourage help)...
1. I want all the messages to be downloaded locally on my laptop (<
100Kb)
2. Deleted messages should be deleted from server (limited quota), but
should be available on my laptop even after deletion.

How do I set-up that?
 
D

Dave Cortright

I moved to IMAP :). It may be simple, but I need to set the following
(could not decipher from Entourage help)...
1. I want all the messages to be downloaded locally on my laptop (<
100Kb)
2. Deleted messages should be deleted from server (limited quota), but
should be available on my laptop even after deletion.

How do I set-up that?

In the account dialog options tab, check the option to always download
complete messages, and also enable the partial download option if you want.
You can also use a Schedule to further refine which folders are synced.

Entourage operates in cached mode always, so whatever message or partial
message is displayed in the list will be available when you are offline.
 
K

Kundan Kumar

In the account dialog options tab, check the option to always download
complete messages, and also enable the partial download option if you want.
You can also use a Schedule to further refine which folders are synced.

Entourage operates in cached mode always, so whatever message or partial
message is displayed in the list will be available when you are offline.
I have done that. The problem is that Entourage deletes the mail from my
local hard-drive when the mail is deleted from server. I need to keep a copy
of all the messages on my hard-disk.
I have tried a rule to copy all mails to a local "archive" folder, but the
rule does not work.
Any tips... Thanks in advance.
 
P

Paul Berkowitz

I have done that. The problem is that Entourage deletes the mail from my
local hard-drive when the mail is deleted from server. I need to keep a copy
of all the messages on my hard-disk.
I have tried a rule to copy all mails to a local "archive" folder, but the
rule does not work.
Any tips... Thanks in advance.

Did you make it an IMAP rule (not a POP rule)? An IMAP rule to copy every
message to a local folder should work perfectly. You could also make an
Outgoing rule to copy sent messages if you want to keep sent messages up on
the server for a while before deleting: Otherwise, just make sure that in
Preferences/Compose you select "Save sent messages in Sent Items folder" and
that in Tools/Accounts/Mail/[your IMAP account]/Advanced you UNCHECK the
server locations for Sent Items (and Drafts?).

--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page: <http://www.entourage.mvps.org/toc.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Entourage you are using - **2004**, X
or 2001. It's often impossible to answer your questions otherwise.
 
K

Kundan Kumar

I have done that. The problem is that Entourage deletes the mail from my
local hard-drive when the mail is deleted from server. I need to keep a copy
of all the messages on my hard-disk.
I have tried a rule to copy all mails to a local "archive" folder, but the
rule does not work.
Any tips... Thanks in advance.

Did you make it an IMAP rule (not a POP rule)? An IMAP rule to copy every
message to a local folder should work perfectly. You could also make an
Outgoing rule to copy sent messages if you want to keep sent messages up on
the server for a while before deleting: Otherwise, just make sure that in
Preferences/Compose you select "Save sent messages in Sent Items folder" and
that in Tools/Accounts/Mail/[your IMAP account]/Advanced you UNCHECK the
server locations for Sent Items (and Drafts?).
Thanks... I was making a pop rule indeed.

Now one last piece of set-up to be solved. I need mails older than 7 days be
deleted from the IMAP server automatically. It seems that I can not do that
unless I specifically mark messages for deletion. Can this be automated?

Regards,
Kundan
 
P

Paul Berkowitz

Did you make it an IMAP rule (not a POP rule)? An IMAP rule to copy every
message to a local folder should work perfectly. You could also make an
Outgoing rule to copy sent messages if you want to keep sent messages up on
the server for a while before deleting: Otherwise, just make sure that in
Preferences/Compose you select "Save sent messages in Sent Items folder" and
that in Tools/Accounts/Mail/[your IMAP account]/Advanced you UNCHECK the
server locations for Sent Items (and Drafts?).
Thanks... I was making a pop rule indeed.

Now one last piece of set-up to be solved. I need mails older than 7 days be
deleted from the IMAP server automatically. It seems that I can not do that
unless I specifically mark messages for deletion. Can this be automated?


Yes, or pretty close to it.

If you don't see a "Deleted Items" or similar-named IMAP folder in your
folder list just under the IMAP server icon, or under the IMAP account's
INBOX icon (some IMAP servers have all other folders as subfolders of the
INBOX), then click on your IMAP account's server icon in the Folder List. In
the main window, you'll see all the account's folders there - some may be
dimmed. If you see a "Deleted Items" or similar-named folder dimmed, click
on it and then click Subscribe button in the toolbar. If there's nothing of
the sort, click New/Folder. Or if all other folders are subfolders of the
INBOX, click on the INBOX in the main window display and click
New/Subfolder. Name it "Deleted Items". Click on it and Subscribe. Now
you'll also see it in your Folder List on the left column.

Go to Tools/Accounts/[your IMAP account]/Edit/Advanced and click the radio
button that says "Move Messages to the Deleted Items folder", and flip the
popup to the Deleted Items folder of your IMAP account if it's there, or
choose Choose and navigate there. Deleted messages will now be moved there.

Now check the box "Empty Deleted Items folder on quit" and the radio button
"Delete message s older than [7] days" (the number of days is configurable.

So you have to quit Entourage now and again for Deleted Items to purge the
7-day old messages, but that's pretty automatic.



--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page: <http://www.entourage.mvps.org/toc.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Entourage you are using - **2004**, X
or 2001. It's often impossible to answer your questions otherwise.
 
K

Kundan Kumar

Did you make it an IMAP rule (not a POP rule)? An IMAP rule to copy every
message to a local folder should work perfectly. You could also make an
Outgoing rule to copy sent messages if you want to keep sent messages up on
the server for a while before deleting: Otherwise, just make sure that in
Preferences/Compose you select "Save sent messages in Sent Items folder" and
that in Tools/Accounts/Mail/[your IMAP account]/Advanced you UNCHECK the
server locations for Sent Items (and Drafts?).
Thanks... I was making a pop rule indeed.

Now one last piece of set-up to be solved. I need mails older than 7 days be
deleted from the IMAP server automatically. It seems that I can not do that
unless I specifically mark messages for deletion. Can this be automated?


Yes, or pretty close to it.

If you don't see a "Deleted Items" or similar-named IMAP folder in your
folder list just under the IMAP server icon, or under the IMAP account's
INBOX icon (some IMAP servers have all other folders as subfolders of the
INBOX), then click on your IMAP account's server icon in the Folder List. In
the main window, you'll see all the account's folders there - some may be
dimmed. If you see a "Deleted Items" or similar-named folder dimmed, click
on it and then click Subscribe button in the toolbar. If there's nothing of
the sort, click New/Folder. Or if all other folders are subfolders of the
INBOX, click on the INBOX in the main window display and click
New/Subfolder. Name it "Deleted Items". Click on it and Subscribe. Now
you'll also see it in your Folder List on the left column.

Go to Tools/Accounts/[your IMAP account]/Edit/Advanced and click the radio
button that says "Move Messages to the Deleted Items folder", and flip the
popup to the Deleted Items folder of your IMAP account if it's there, or
choose Choose and navigate there. Deleted messages will now be moved there.

Now check the box "Empty Deleted Items folder on quit" and the radio button
"Delete message s older than [7] days" (the number of days is configurable.

So you have to quit Entourage now and again for Deleted Items to purge the
7-day old messages, but that's pretty automatic.
Yes.. I have that set. But then I need to manually choose the items I wish
to delete. What I am looking for is the ability to delete all the mails from
inbox which are more than 7 days old (not requiring me to select the mails
to delete).
I have tried putting up a schedule but it won't let me select an IMAP folder
to act on (only local folders).
Any tips. Thanks in advance.
 
P

Paul Berkowitz

Yes.. I have that set. But then I need to manually choose the items I wish
to delete. What I am looking for is the ability to delete all the mails from
inbox which are more than 7 days old (not requiring me to select the mails
to delete).
I have tried putting up a schedule but it won't let me select an IMAP folder
to act on (only local folders).
Any tips. Thanks in advance.


Use the schedule to run this script (saved i Script Editor to your Entourage
Script Menu Items folder as a Script):

set expiredTime to (current date - (7 * days))
tell app "Microsoft Entourage"
set theFolder to IMAP INBOX folder of IMAP account "Whatever it's
called"
-- or: set theFolder to folder "Any folder" of IMAP account "Whatever
it's called"
delete every message of theFolder whose sent time < expiredTime
end tell


That will plop the messages into the IMAP Deleted Items folder and the
account setup will purge them from there when you quit Entourage. OR you
could try adding this line to the end of the script, just above the 'end
tell':

delete every message of IMAP deleted items folder of IMAP account
"Whatever it's called"

I'm not 100% sure that will purge immediately, but it might.
 
K

Kundan Kumar

Use the schedule to run this script (saved i Script Editor to your Entourage
Script Menu Items folder as a Script):

set expiredTime to (current date - (7 * days))
tell app "Microsoft Entourage"
set theFolder to IMAP INBOX folder of IMAP account "Whatever it's
called"
-- or: set theFolder to folder "Any folder" of IMAP account "Whatever
it's called"
delete every message of theFolder whose sent time < expiredTime
end tell


That will plop the messages into the IMAP Deleted Items folder and the
account setup will purge them from there when you quit Entourage. OR you
could try adding this line to the end of the script, just above the 'end
tell':

delete every message of IMAP deleted items folder of IMAP account
"Whatever it's called"

I'm not 100% sure that will purge immediately, but it might.
Thanks a lot. Everything works except for immediate purge (I don't need
it... It will get deleted when I quit entourage).
Thanks again...

PS: the script needed a fix (instead of "sent time" on 2nd last line, it
should be "time sent")
 
B

Barry Wainwright

I use entourage on my laptop. During the course of the day, I switch
networks many times. I use "Leave a copy of messages on server" and then
"Delete messages from server". Sometimes all of my account emails are
downloaded again. Right now, I have four copies of most of the messages.

What can I do to get rid of the duplicate messages and keep only 1. Can it
be automatic?

Regards,
Kundan

This script will do it:

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 my 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
end tell
 
K

Kundan Kumar

This script will do it:

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 my 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
end tell

Great .. Looks like the above works. One point to note. If a big message has
two duplicated copies: one with attachment, other partially received one,
they are not treated as duplicate messages.

The voice feedback is really good!
 
Top