If you are still on the old email format, from the Inbox page go to Preferences>>>>>Email>>>>>Email Deletion Schedule. The maximum time for retention in Trash is 30 days. If you are in the new format, Spam is stored for 7 days or 2,000 messages, whichever comes first
Trash is stored for 14 days or 5,000 messages, whichever comes first. You can't change them.