property removeSpamMessagesFromServer : true
On 3/29/04 9:09 PM, Mark Goodman <[EMAIL PROTECTED]> wrote:
Currently all of my email accounts are set to leave the mail on the server for 14 days. Is there a way that I can modify the AppleScript below so it also removes the mail from the server if “SpamSieve” identifies it as spam?
property spamFolderName : "Spam" -- must be a local folder
property spamFolderContainerName : "" -- "" means On My Computer
property markSpamMessagesRead : false
property removeSpamMessagesFromServer : false
property tryToMoveIMAPMessages : false
tell application "Microsoft Entourage"
if not (exists category "Junk") then
make new category with properties {name:"Junk", color:{29952, 29952, 29952}}
end if
set msgs to current messages -- doesn't work without temp variable
repeat with m in msgs
try
set s to m's source
tell application "SpamSieve"
set isSpam to (looks like spam message s)
end tell
if isSpam then
set category of m to {category "Junk"}
if markSpamMessagesRead then set read status of m to read
if removeSpamMessagesFromServer and m's online status is fully downloaded then set connection action of m to remove at next connection
my moveToSpamFolder(m)
end if
on error e
--display dialog "Error in Move Spam" default answer e
end try
end repeat
end tell
on moveToSpamFolder(m)
tell application "Microsoft Entourage"
if spamFolderContainerName is "" then
if not (exists folder spamFolderName) then
make new folder with properties {name:spamFolderName}
end if
set destFolder to folder spamFolderName
else
if not (exists folder spamFolderName of folder spamFolderContainerName) then
make new folder with properties {name:spamFolderName, parent:folder spamFolderContainerName}
end if
set destFolder to folder spamFolderName of folder spamFolderContainerName
end if
if tryToMoveIMAPMessages then
set {theAccount, theSource, theClass} to m's {account, source, class}
set ifRead to read status of m
make new incoming message at destFolder with properties {account:theAccount, source:theSource, read status:ifRead}
delete m
else
set storage of m to destFolder
end if
end tell
end moveToSpamFolder
