Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Simplify the deletion of Mail's junk mail Apps
For as long as I've can recall, I've been following the same routine with Mail's Junk folder: I open the folder, scan the subjects of any trapped messages, and then open anything that looks like it might have been a regular piece of email. After moving any improperly flagged mesasges to their proper homes, I then delete the junk mail.

Unfortunately, for as long as I can recall, this action has required two keyboard actions--Command-Option-J, the Erase Junk Mail shortcut, followed by a press of the Return key to say Yes, I really want to delete the junk mail. I believe I submitted a feature request a few years back, asking for an option to remove the second dialog, but nothing ever came of it. When I tell Mail to delete my junk mail, I'm already sure I want it gone, and I find the confirmation dialog quite annoying.

Today it finally annoyed me to the breaking point, so I created a solution using Butler. I wrote a very simple keyboard macro to handle the emptying of my Junk folder. (I would assume something quite similar is possible in both Quicksilver and LaunchBar, but I don't have much experience with either of those tools.) Now, with the press of one keyboard combo, my Junk mail folder is emptied without any further interaction on my part.

To create a new keyboard macro in Butler, click the Plus sign at the lower left corner of Butler's configuration window, then select Smart Item -> Keystrokes from the pop-up menu. While you could create this command in any of Butler's item types, it probably makes the most sense to store it in Hidden, since you'll only be accessing it via a keyboard shortcut. Give it a useful name (so you recognize it in Butler's configuration list), and then enter the following values on each tab:
  • Keys: Press Command-Option-J, delay 0.1 seconds (accessed via the Plus sign pop-up below the input area), then press Return. This macro will activate the Delete Junk Mail dialog, wait a little bit for it to appear onscreen, and then select the Yes option (since it's the default).
  • Triggers: Assign whatever Hot Key you like; I used Shift-Command-Option-J, since that was similar to the existing shortcut. When you assign the hot key, the Exceptions area will appear. Set the pop-up to "Only" valid in, then type Mail. This tells Butler to only make the shortcut work inside of Mail.
  • Looks: You don't need to edit this at all. However, I have a lot of Butler-created keystroke actions, though, so I tend to set the icon to the associated application (Mail). This makes it easier to find things on the configuration screen.
When you're done, the Keys and Triggers tabs should look like this (click for a larger version):


And that's it -- you're done. Switch back to Mail, hit Shift-Command-Option-J (or whatever you assigned) and revel in the now-automated junk mail deletion.

You could use a minor variant of this to make erasing all deleted messages a one-step affair--just use Command-K as the first step of the script, as that's the relevent shortcut. I haven't done this myself, though, as I'm not so confident about erasing my deleted messages.
    •    
  • Currently 2.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[8,908 views]  

Simplify the deletion of Mail's junk mail | 13 comments | Create New Account
Click here to return to the 'Simplify the deletion of Mail's junk mail' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Simplify the deletion of Mail's junk mail
Authored by: drempel on Feb 20, '06 07:45:03AM

I think this has been posted before, but try CMD-A CMD-X (select and delete all). Yes, it's two keystrokes, but it's quick, you don't have to move your fingers, no Nag Dialog, works with Mail's Trash (or anywhere else, for that matter), etc.



[ Reply to This | # ]
Simplify the deletion of Mail's junk mail
Authored by: robg on Feb 20, '06 08:11:24AM

It does work, but only if you have the Junk mail folder selected. The macro solution works from anywhere :).

-rob.



[ Reply to This | # ]
But Rob,
Authored by: jecwobble on Feb 20, '06 09:21:20AM

Didn't you say your first step was to 'open the junk folder and scan the subjects?' After you move non-junk mail out of the folder, aren't you still in the junk folder?

I do the CMD+A, but then I just hit the delete key instead of CMD+X (one less key to press).



[ Reply to This | # ]
But Rob,
Authored by: robg on Feb 20, '06 10:47:37AM

I gave a simplified example :). For instance, there are times when I'll see some junk come in (via the activity monitor), and now I can just use the shortcut to make it vanish, without first changing folders.

-rob.



[ Reply to This | # ]
But Rob,
Authored by: robg on Feb 20, '06 10:50:02AM

Also, if you use Delete, the Junk moves from the Junk mail folder to the Trash folder. Using the menu command simply erases it all. I probably should have put this in the main hint.

-rob.



[ Reply to This | # ]
Might seem like a minor issue…
Authored by: jiclark on Feb 20, '06 10:54:22AM

…but your solution moves the selected to the Trash folder. The Erase Junk Mail command does what I want: it erases them, permanently. I really don't want all the Junk to end up filling up my Trash folder, making me have to deal with that more often. Yes, I could set Trash to empty on an automatic schedule, but I'm one of those that likes to have the option of going back and searching Trash for something I may want at a later date.



[ Reply to This | # ]
Simplify the deletion of Mail's junk mail
Authored by: Barney-15 on Feb 20, '06 08:47:02AM
Or, you could just turn on automatic deletion of junk mail in the preferences. Or, you could use this Applescript:
tell application "Mail"
    delete messages of junk mailbox
end tell
You could once assign keyboard shortcuts to scripts, but I can't seem to make it work anymore, so you'd have to use the scripts menu.

---
Jim

[ Reply to This | # ]

Simplify the deletion of Mail's junk mail
Authored by: sjk on Feb 20, '06 10:11:03AM
Or, you could just turn on automatic deletion of junk mail in the preferences

But Rob said he checks for any non-junk messages first.

[ Reply to This | # ]
Simplify the deletion of Mail's junk mail
Authored by: jmontana on Feb 20, '06 10:25:41AM

So go to Preferences > Accounts > Mailbox Behaviors and set "Erase messages in the junk mailbox when" to "One week old."

As long as you check your junk mailbox at least once a week for valid messages, your junk mailbox stays nice and clean with just one week's worth of junk mail.

You could change that to "One month old" or "One day old" if you desire more or less time to validate, respectively.

I've been doing this for ages. Works quite well for me.



[ Reply to This | # ]
Simplify the deletion of Mail's junk mail
Authored by: Barney-15 on Feb 20, '06 02:10:21PM

Sorry, I should have mentioned the options in the original post.

---
Jim



[ Reply to This | # ]
Simplify the deletion of Mail's junk mail
Authored by: rsfinn on Feb 20, '06 09:51:51AM

I'm trying to spend less time actively managing my junk mail -- after all, if I'm spending any time thinking about junk mail at all, the spammers are winning -- so I just go into the "Mailbox behavior" tab for my accounts and tell Mail to delete my junk messages when they're one week old, and then never think about them again. (Obviously you could make this "one day old" or "when quitting Mail" if you like.)



[ Reply to This | # ]
Simplify the deletion of Mail's junk mail
Authored by: joh on Feb 20, '06 01:43:34PM

Not to belittle that hint, but I would recommend to save your spam (compress and burn a cd, or whatever) before deleting it. First, if you're getting lots of spam, you might have one or more "good" messages filtered and you may notice that too late. Second, your very own spam is actually a resource -- it shows who is spamming you with what kind of stuff and this may help you at some point in the future to train spam filters. So, don't outright delete your spam. Keep it somewhere, it's not valueless.



[ Reply to This | # ]
Simplify the deletion of Mail's junk mail
Authored by: robg on Feb 20, '06 03:17:45PM

I receive on the order of 20,000 spams per month. The vast majority of these, thankfully, are trapped at the server. But still, about 100 or so a day make it through to my machine. As noted in the hint, I review them all for false captures and reclaim those, so there's no fear of losing a good email.

And I use every spam I get to train our filters; I copy them to the spam server's learning folder prior to deletion.

-rob.



[ Reply to This | # ]