Set custom retention intervals in Mail

29.05.2009
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 (free with a free developer account), you can use Property List Editor; if you haven't, the best alternative I've found is .

(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 com.apple.mail.plist. 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 com.apple.mail.plist in the (probably huge) list of files, then click Open.