Symptom
Email messages are deleted after seven days despite configuring the mailbox to delete after a longer period of time.
Mailboxes that are not in the On My Mac section, including the non-On My Mac In, Drafts, Trash, Sent and Junk mailboxes, are not affected.
Solution
Messages that are moved to a mailbox in the "On My Mac" section of the mailbox list do not respect the Special Mailboxes "Erase deleted messages" preference. If you drag a message to the Trash from a mailbox's "On My Mac" section, it will be deleted after seven days.
Use the following advanced workaround if you would like:
1. Open Terminal (/Applications/Utilities).
2. Type the following, depending on the settings you prefer:
To never empty the Trash for deleted "On My Mac" messages, type:
defaults write com.apple.mail NumberOfDaysToKeepTrash -1
To erase "On My Mac" messages that are in the Trash when quitting, type:
defaults write com.apple.mail NumberOfDaysToKeepTrash 0
To erase "On My Mac" messages that are in the Trash and older than one week, type:
defaults write com.apple.mail NumberOfDaysToKeepTrash 7
Note: This is the default behavior, but it is presented here in case you wish to revert to this setting after using a different one.
To erase "On My Mac" messages that are in the Trash and older than one month, type:
defaults write com.apple.mail NumberOfDaysToKeepTrash 30
3. Press Return.