I'd like to create a button in Mountain Lion's Mail.app to move mail to an IMAP folder called Junk, much like the Archive button moves mail to my IMAP Archive folder. (This folder is automatically emptied on my server periodically and used to train spam filters.)

I thought perhaps I could leverage the Junk button, but that seems to require turning on the built-in filtering engine, which I do not believe I want to do. I specifically want to just move the message myself explicitly.

I'm currently using the Favorites bar, to which I've added the requisite folder, and I can either drag messages there or use the keyboard shortcut (e.g. command-control-4, since it's the fourth folder on my bar—unfortunately, I find such a combo awkward to press), but I'd really prefer a button I could stick on the toolbar.

1 Answer 1


You can do this exactly by "customizing" the action that the "Junk" button performs:

Mail Menu> Preferences> Junk Mail tab>

When Junk Mail Arrives: select Perform Custom actions (Click Advanced to configure)

Then, click Advanced button in lower center of Pref Pane, next to Reset

This allows you to create a custom Rule, essentialy, just like other Rules, in the "Rules" Preference Pane, but it activates when you click the "Junk" button or when Mail thinks it found something that is Junk (keep reading to limit automatic Junk Mail filtering).

  • *Notice how the default rule has the condition that "Message is Junk"? Possibly just removing this will avoid Mail from auto-triggering the filter, maybe, however, there is another step we can take (keep reading).
  • *I would probably delete all the conditions here by default (which are just the same as the default actions)

The rule I would suggest is:

  • If "any" of the following conditions are met
  • "account" is "name of your account in question"
  • Perform the following actions "Move Message" to mailbox "name of the mailbox that you have set-up on your server as 'Junk' or similar" (as oppose to the "Junk" folder built-in to Mail.app)

That's most of it. Additional tips/possibilities:

  • You could Reset the filter. However, to really take control, see the numbered list below.
  • Uncheck Trust junk mail headers in messages (if you want more control over your Junk Mail filter)
  • I would leave the other options about exemption checked, as they stop the filter from auto-triggering.

To become master of your Junk Mail 'Smart Filter':

  1. QUIT Mail.app
  2. In Finder, hit 'command-shift-g' and paste or type without the single-quotes/apostrophes '~/Library/Mail/'
  3. look for the file "LSMMap2". On my Mountain Lion Install it is located in:
    and does not appear to be hidden
  4. Once located, delete the file.
  5. Create an empty text file (remember not to hide its extension, you do not want any extension, and save it/move it to the same folder LSMMAP2 was in.
  6. Get info on the new *empty* LSMMAP2 file (command-i once you have the file selected in Finder)
  7. Click the "Locked" check box under the "General" disclosure triangle (the are wherein is stated file size, type, dates, location, etc. (Also, double check that there is no '.txt' or '.rtf' file extension under the "Name & Extension area")
  8. You're done, now Mail can't 'learn' about spam anymore since you just 'locked' it's 'notebook'.
  9. You could always click the 'Reset' button if you like, just to make sure there are no temporary/cached files around since Mountain Lion loves to create these (invisibly).
  10. Cleaning out temporary files is a secondary fallback, like running the Unix 'cron' Daily/Monthly/Weekly scripts, etc. There are many programs out there that can do this from the normal interface without command line etc, and there are many more cache files out there too. My favorite is Cocktail.

    If you can't find the LSMMAP2 file, just use the Junk Mail button for a little while, then come back and look for it again. Since, if you reset it, it may have been deleted.

  • Interesting strategy regarding the LSMMap2 file. I'll give this one a shot and come back after I've put it through its paces.
    – Mattie
    Mar 21, 2013 at 17:37
  • This seems to be working pretty well. FWIW, I went ahead and just set it to move the message to Junk, since it lands in the proper place for this account.
    – Mattie
    Mar 22, 2013 at 14:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .