Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Applications > AppleScript to delete Junk mail works partially

AppleScript to delete Junk mail works partially
Thread Tools
rw
Mac Enthusiast
Join Date: Dec 2000
Location: Kirkland, WA, USA
Status: Offline
Reply With Quote
Nov 7, 2004, 10:24 AM
 
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
Reply With Quote
Nov 8, 2004, 04:15 PM
 
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.
Good Luck!

Dr. Smoke
Author: Troubleshooting Mac OS X
     
Professional Poster
Join Date: Jul 2001
Location: New York, NY
Status: Offline
Reply With Quote
Nov 8, 2004, 04:34 PM
 
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
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:05 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2