 |
 |
AppleScript to delete Junk mail works partially
|
 |
|
 |
|
Mac Enthusiast
Join Date: Dec 2000
Location: Kirkland, WA, USA
Status:
Offline
|
|
I have a simple AppleScript in my Mail Script folder to delete all my Junk mail. Sometimes when I run it, though, it only deletes some of the junk mail. I run it a second time, and it deletes some more. I may have to run it 3 or 4 times to clear out the Junk mail folder. Can anyone explain this to me?
Code:
tell application "Mail"
repeat with theAccount in every account
try
set junkMessages to every message in mailbox "Junk" in theAccount
repeat with theMessage in junkMessages
delete theMessage
end repeat
end try
end repeat
end tell
(If there is an "I Hate AppleScript" club, please let me know; I want to join.  )
|
|
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Sep 2004
Location: Earth
Status:
Offline
|
|
I suggest a different approach entirely to Junk mail. I've set Mail's preferences to use the Trash as the Junk Mail folder. The a simple Command-K keyboard shortcut, which empties Mail's Trash, gets rid of it all.
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Jul 2001
Location: New York, NY
Status:
Offline
|
|
Originally posted by Dr. Smoke:
I suggest a different approach entirely to Junk mail. I've set Mail's preferences to use the Trash as the Junk Mail folder. The a simple Command-K keyboard shortcut, which empties Mail's Trash, gets rid of it all.
honest question: how does that allow mail to distinguish between junk and non-junk mail that you've simply deleted? (i.e. dragging a message to the junk folder, even when not in training mode, marks the message as "junk" and updates the "learning" that Mail is doing - is everything in your deleted folder marked as junk?
-------------
For the original poster - why use an applescript? There's a "delete junk mail" command available from the action menu button in the account drawer...
|
|
cpac
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |