Set Custom Retention Intervals in Mail

Today's Best Tech Deals

Picked by PCWorld's Editors

Top Deals On Great Products

Picked by Techconnect's Editors

In Apple's Mail program, you can use the Mailbox Behaviors tab of the Accounts panel to set how long Mail keeps sent, junk and trashed messages. Unfortunately, the options are somewhat limited. You can choose to never delete them or delete them when quitting Mail; you can also opt to delete them daily, weekly, or monthly. For me, none of those options are necessarily ideal--I like to keep my sent messages, for instance, for six months.

While Mail doesn't give you any way to change these values, you can do it with a simple edit of Mail's preferences file. Note that to do this, you'll need a preferences file editing program.

If you've installed Apple's Developer Tools (free with a free developer account), you can use Property List Editor; if you haven't, the best alternative I've found is PlistEdit Pro.

(You can technically do these edits using a pure text editor, too, though you'll have to convert Mail's preferences to and from XML mode to do that. I'll leave that as an exercise for the advanced users.)

To set your own expiration period for sent, junk, or trashed messages, first quit Mail, and back up your user's Mail preferences file--it's located in ~/Library -> Preferences, and it's named Option-drag it to another spot on your drive to make a backup.

Once you have a good backup, launch your property list editing program. Choose File -> Open, and navigate to your user's Library -> Preferences folder. Select in the (probably huge) list of files, then click Open.

Once the preferences file is open, click the triangle next to Root to expand the entries (if they're not showing already) then scroll down to the MailAccounts section. Click the triangle there, and you'll see a series of numbers.

The first entry isn't an e-mail account, nor is the last entry (most likely) in the list--the first is an entry for a local mailbox, and the last is an entry for Mail's RSS. But the numbers between those two values each represent one of your e-mail accounts.

Click the triangle next to the 2, for instance, and then look at the AccountName field (or click the triangle next to EmailAddresses) to see which account you've selected. Scroll down until you reach the entries that start with NumberOfDays..., as seen in the image at right. These are relatively self-explanatory; each figure is the number of days that Mail will retain that class of message before deleting. (If a value is -1, that means never delete; if it's 0, that means delete when you quit Mail.)

To specify a custom keep interval, double-click the desired entry (for junk, sent, or trash) in the Value column, and type a new value. Enter your values in days, i.e. 180 is six months. Save the file, quit the editor, and you're done. Mail will now use your custom retention values, though you can easily overwrite them (either accidentally or because you'd like to reset them) by using the pop-up menus on the Mailbox Behaviors tab of the Accounts panel in Mail's preferences.

This story, "Set Custom Retention Intervals in Mail" was originally published by Macworld.

Note: When you purchase something after clicking links in our articles, we may earn a small commission. Read our affiliate link policy for more details.
Shop Tech Products at Amazon